diff options
author | David Karlaš <david.karlas@xamarin.com> | 2016-09-12 14:01:27 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2016-09-12 14:01:27 +0300 |
commit | ca1db0bc7e7d5f91aca054890681dabe7485a600 (patch) | |
tree | 1478cc7616f0b31b682fe25640fee9383266eec8 /mcs/class/Mono.Debugger.Soft | |
parent | 0a0be23e6f4f449872e9a39194ad157e96e5a0f2 (diff) |
[Debugger] GetLocals was throwing NullReferenceException(li.scopes_start) if ran against older runtime
Added logic to make sure user of API handles version checking when calling GetScope
Made properties in LocalScope class public
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs | 4 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs index c5c3673d478..52c58b232e3 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/LocalScope.cs @@ -19,13 +19,13 @@ namespace Mono.Debugger.Soft } } - internal int LiveRangeStart { + public int LiveRangeStart { get { return live_range_start; } } - internal int LiveRangeEnd { + public int LiveRangeEnd { get { return live_range_end; } 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 34bcb230ed7..fb10f7117c3 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs @@ -240,7 +240,8 @@ namespace Mono.Debugger.Soft } } - public LocalScope[] GetScopes () { + public LocalScope [] GetScopes () { + vm.CheckProtocolVersion (2, 43); GetLocals (); return scopes; } @@ -265,9 +266,11 @@ namespace Mono.Debugger.Soft for (int i = 0; i < li.names.Length; ++i) locals [i + pi.Length] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false); - scopes = new LocalScope [li.scopes_start.Length]; - for (int i = 0; i < scopes.Length; ++i) - scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]); + if (vm.Version.AtLeast (2, 43)) { + scopes = new LocalScope [li.scopes_start.Length]; + for (int i = 0; i < scopes.Length; ++i) + scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]); + } } return locals; } |