diff options
author | Zoltan Varga <vargaz@gmail.com> | 2017-06-02 20:43:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-02 20:43:56 +0300 |
commit | 010fce60af693fdb80c814b94825a1ca9b9bac1e (patch) | |
tree | cdf9e671f7280de6f6e1a8d45d1866d0ae50eb66 /mcs/class/Mono.Debugger.Soft | |
parent | c3667fa86167dd763de47e329eb90a0229839f92 (diff) |
[sdb] Add an API to make the contents of the 'State Machine Hoisted Local Scopes' table in ppdb files available in sdb. (#4961)
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
3 files changed, 33 insertions, 1 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index af3e1716ca4..6172b440f49 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -119,6 +119,9 @@ namespace Mono.Debugger.Soft public int[] live_range_end; public int[] scopes_start; public int[] scopes_end; + public int nhoisted; + public int[] hoisted_scopes_start; + public int[] hoisted_scopes_end; } struct PropInfo { @@ -420,7 +423,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 45; + internal const int MINOR_VERSION = 46; enum WPSuspendPolicy { NONE = 0, @@ -1927,6 +1930,15 @@ namespace Mono.Debugger.Soft info.scopes_end [i] = info.scopes_start [i] + res.ReadInt (); last_start = info.scopes_start [i]; } + if (Version.AtLeast (2, 46)) { + info.nhoisted = res.ReadInt (); + info.hoisted_scopes_start = new int [info.nhoisted]; + info.hoisted_scopes_end = new int [info.nhoisted]; + for (int i = 0; i < info.nhoisted; ++i) { + info.hoisted_scopes_start [i] = res.ReadInt (); + info.hoisted_scopes_end [i] = res.ReadInt (); + } + } } int nlocals = res.ReadInt (); diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs index fb10f7117c3..65e3abc54dc 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs @@ -24,6 +24,7 @@ namespace Mono.Debugger.Soft MethodBodyMirror body; MethodMirror gmd; TypeMirror[] type_args; + LocalScope[] hoisted_scopes; internal MethodMirror (VirtualMachine vm, long id) : base (vm, id) { } @@ -246,6 +247,16 @@ namespace Mono.Debugger.Soft return scopes; } + // + // Return the contents of the State Machine Hoisted Locals Scope record: + // https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#state-machine-hoisted-local-scopes-c--vb-compilers + // + public LocalScope [] GetHoistedScopes () { + vm.CheckProtocolVersion (2, 46); + GetLocals (); + return hoisted_scopes; + } + public LocalVariable[] GetLocals () { if (locals == null) { LocalsInfo li = new LocalsInfo (); @@ -271,6 +282,10 @@ namespace Mono.Debugger.Soft for (int i = 0; i < scopes.Length; ++i) scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]); } + + hoisted_scopes = new LocalScope [li.nhoisted]; + for (int i = 0; i < li.nhoisted; ++i) + hoisted_scopes [i] = new LocalScope (vm, this, li.hoisted_scopes_start [i], li.hoisted_scopes_end [i]); } return locals; } diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 631b5985db1..2586a315eb4 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -1050,6 +1050,11 @@ public class DebuggerTests e = step_in_await ("ss_await", e);//ss_await_1_exc (true, false).Wait ();//out e = step_in_await ("MoveNext", e);//{ + + // Check hoisted scope information + var hoisted = (e as StepEvent).Method.GetHoistedScopes (); + Assert.AreEqual (2, hoisted.Length); + e = step_out_await ("ss_await", e);//ss_await_1_exc (true, true).Wait ();//out } |