X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FPEAPI%2FCode.cs;h=60f09b4e92d2d185568506f47987d2632a797b1b;hb=44bf6d5a50ad5dccdd560ac7437ae3f66d86e51a;hp=af8ae771cfa48247779c2f81463aa9719be4c282;hpb=f1f8b8a867c800b21b6a03767252403c2f72cae2;p=mono.git diff --git a/mcs/class/PEAPI/Code.cs b/mcs/class/PEAPI/Code.cs index af8ae771cfa..60f09b4e92d 100644 --- a/mcs/class/PEAPI/Code.cs +++ b/mcs/class/PEAPI/Code.cs @@ -701,6 +701,7 @@ namespace PEAPI { exceptions = new ArrayList(); else if (exceptions.Contains(tryBlock)) return; exceptions.Add(tryBlock); + tryBlock.ResolveCatchBlocks (metaData); } /// @@ -975,6 +976,16 @@ namespace PEAPI { return fatFormat; } + //Hackish + internal void ResolveCatchBlocks (MetaData md) + { + for (int i=0; i < handlers.Count; i++) { + Catch c = handlers [i] as Catch; + if (c != null) + c.ResolveType (md); + } + } + internal override void Write(FileImage output, bool fatFormat) { // Console.WriteLine("writing exception details"); @@ -1013,7 +1024,7 @@ namespace PEAPI { /// public class Catch : HandlerBlock { - Class exceptType; + MetaDataElement exceptType; /// /// Create a new catch clause @@ -1021,12 +1032,23 @@ namespace PEAPI { /// the exception to be caught /// start of the handler code /// end of the handler code - public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd) + public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd) + : base(handlerStart, handlerEnd) + { + exceptType = except; + } + + public Catch(Type except, CILLabel handlerStart, CILLabel handlerEnd) : base(handlerStart,handlerEnd) { exceptType = except; } + internal void ResolveType (MetaData md) + { + exceptType = ((Type) exceptType).GetTypeSpec (md); + } + internal override void Write(FileImage output, bool fatFormat) { base.Write(output,fatFormat); @@ -1274,10 +1296,17 @@ namespace PEAPI { int tide = 0; CILInstruction labInstr; uint offset = 0; + bool absolute; - public CILLabel (uint offset) + + public CILLabel (uint offset, bool absolute) { this.offset = offset; + this.absolute = absolute; + } + + public CILLabel (uint offset) : this (offset, false) + { } @@ -1310,6 +1339,7 @@ namespace PEAPI { internal uint GetLabelOffset() { + if (absolute) return offset; if (labInstr == null) return 0; return labInstr.offset + offset; }