diff options
Diffstat (limited to 'Mono.Cecil.Cil')
-rw-r--r-- | Mono.Cecil.Cil/CodeReader.cs | 15 | ||||
-rw-r--r-- | Mono.Cecil.Cil/Symbols.cs | 34 |
2 files changed, 33 insertions, 16 deletions
diff --git a/Mono.Cecil.Cil/CodeReader.cs b/Mono.Cecil.Cil/CodeReader.cs index c13db7d..f7f11d5 100644 --- a/Mono.Cecil.Cil/CodeReader.cs +++ b/Mono.Cecil.Cil/CodeReader.cs @@ -416,12 +416,17 @@ namespace Mono.Cecil.Cil { void ReadStateMachineScope (StateMachineScopeDebugInformation state_machine_scope) { - state_machine_scope.start = new InstructionOffset (GetInstruction (state_machine_scope.start.Offset)); + if (state_machine_scope.scopes.IsNullOrEmpty ()) + return; - var end_instruction = GetInstruction (state_machine_scope.end.Offset); - state_machine_scope.end = end_instruction == null - ? new InstructionOffset () - : new InstructionOffset (end_instruction); + foreach (var scope in state_machine_scope.scopes) { + scope.start = new InstructionOffset (GetInstruction (scope.start.Offset)); + + var end_instruction = GetInstruction (scope.end.Offset); + scope.end = end_instruction == null + ? new InstructionOffset () + : new InstructionOffset (end_instruction); + } } void ReadSequencePoints () diff --git a/Mono.Cecil.Cil/Symbols.cs b/Mono.Cecil.Cil/Symbols.cs index 600d908..4c4a8b0 100644 --- a/Mono.Cecil.Cil/Symbols.cs +++ b/Mono.Cecil.Cil/Symbols.cs @@ -523,7 +523,7 @@ namespace Mono.Cecil.Cil { } } - public sealed class StateMachineScopeDebugInformation : CustomDebugInformation { + public sealed class StateMachineScope { internal InstructionOffset start; internal InstructionOffset end; @@ -538,27 +538,39 @@ namespace Mono.Cecil.Cil { set { end = value; } } - public override CustomDebugInformationKind Kind { - get { return CustomDebugInformationKind.StateMachineScope; } - } - - public static Guid KindIdentifier = new Guid ("{6DA9A61E-F8C7-4874-BE62-68BC5630DF71}"); - - internal StateMachineScopeDebugInformation (int start, int end) - : base (KindIdentifier) + internal StateMachineScope (int start, int end) { this.start = new InstructionOffset (start); this.end = new InstructionOffset (end); } - public StateMachineScopeDebugInformation (Instruction start, Instruction end) - : base (KindIdentifier) + public StateMachineScope (Instruction start, Instruction end) { this.start = new InstructionOffset (start); this.end = end != null ? new InstructionOffset (end) : new InstructionOffset (); } } + public sealed class StateMachineScopeDebugInformation : CustomDebugInformation { + + internal Collection<StateMachineScope> scopes; + + public Collection<StateMachineScope> Scopes { + get { return scopes ?? (scopes = new Collection<StateMachineScope> ()); } + } + + public override CustomDebugInformationKind Kind { + get { return CustomDebugInformationKind.StateMachineScope; } + } + + public static Guid KindIdentifier = new Guid ("{6DA9A61E-F8C7-4874-BE62-68BC5630DF71}"); + + public StateMachineScopeDebugInformation () + : base (KindIdentifier) + { + } + } + public sealed class EmbeddedSourceDebugInformation : CustomDebugInformation { internal byte [] content; |