diff options
author | Jeffrey Stedfast <jeff@xamarin.com> | 2012-02-01 04:14:27 +0400 |
---|---|---|
committer | Jeffrey Stedfast <jeff@xamarin.com> | 2012-02-01 04:14:27 +0400 |
commit | bec9e57ad165f3528c3d863afefdc87e1d28a055 (patch) | |
tree | 4bc41dfc98252508a0ab7919eacf7ee20395fd37 /extras | |
parent | 483ec588a4eeb4b26cce0d2090854e0e76440212 (diff) |
[Debugger] Implemented chunking of raw strings from the debugger
This is needed for handling large strings in a more graceful way
(i.e. without blocking the UI when streaming the raw string value
from the debugger).
Finishes the fix for bug #1547.
Diffstat (limited to 'extras')
4 files changed, 87 insertions, 10 deletions
diff --git a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs index d05fbde242..095fc8a27b 100644 --- a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs +++ b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs @@ -34,18 +34,19 @@ namespace MonoDevelop.Debugger.Win32 { class ArrayAdaptor: ICollectionAdaptor { - CorValRef obj; CorEvaluationContext ctx; + CorArrayValue array; + CorValRef obj; - public ArrayAdaptor (EvaluationContext ctx, CorValRef obj) + public ArrayAdaptor (EvaluationContext ctx, CorValRef obj, CorArrayValue array) { - this.obj = obj; this.ctx = (CorEvaluationContext) ctx; + this.array = array; + this.obj = obj; } public int[] GetDimensions () { - CorArrayValue array = CorObjectAdaptor.GetRealObject (ctx, obj) as CorArrayValue; if (array != null) return array.GetDimensions (); else @@ -55,7 +56,6 @@ namespace MonoDevelop.Debugger.Win32 public object GetElement (int[] indices) { return new CorValRef (delegate { - CorArrayValue array = CorObjectAdaptor.GetRealObject (ctx, obj) as CorArrayValue; if (array != null) return array.GetElement (indices); else @@ -77,7 +77,6 @@ namespace MonoDevelop.Debugger.Win32 public ObjectValue CreateElementValue (ArrayElementGroup grp, ObjectPath path, int[] indices) { - CorArrayValue array = CorObjectAdaptor.GetRealObject (ctx, obj) as CorArrayValue; if (array != null) { CorValRef elem = (CorValRef) GetElement (indices); return ctx.Adapter.CreateObjectValue (ctx, grp, path, elem, ObjectValueFlags.ArrayElement); diff --git a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs index 701f231ac2..b4852b0c7d 100644 --- a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs +++ b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs @@ -63,6 +63,11 @@ namespace MonoDevelop.Debugger.Win32 {
return GetRealObject (ctx, val) is CorArrayValue;
}
+
+ public override bool IsString (EvaluationContext ctx, object val)
+ {
+ return GetRealObject (ctx, val) is CorStringValue;
+ }
public override bool IsClassInstance (EvaluationContext ctx, object val)
{
@@ -646,8 +651,20 @@ namespace MonoDevelop.Debugger.Win32 public override ICollectionAdaptor CreateArrayAdaptor (EvaluationContext ctx, object arr)
{
- if (GetRealObject (ctx, arr) is CorArrayValue)
- return new ArrayAdaptor (ctx, (CorValRef) arr);
+ CorValue val = CorObjectAdaptor.GetRealObject (ctx, arr);
+
+ if (val is CorArrayValue)
+ return new ArrayAdaptor (ctx, (CorValRef) arr, (CorArrayValue) val);
+ else
+ return null;
+ }
+
+ public override IStringAdaptor CreateStringAdaptor (EvaluationContext ctx, object str)
+ {
+ CorValue val = CorObjectAdaptor.GetRealObject (ctx, str);
+
+ if (val is CorStringValue)
+ return new StringAdaptor (ctx, (CorValRef) str, (CorStringValue) val);
else
return null;
}
diff --git a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj index a13addf603..09baf053a2 100644 --- a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj +++ b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -97,6 +97,7 @@ </ItemGroup> <ItemGroup> <Compile Include="ArrayAdaptor.cs" /> + <Compile Include="StringAdaptor.cs" /> <Compile Include="CorBacktrace.cs" /> <Compile Include="CorMethodCall.cs" /> <Compile Include="CorValRef.cs" /> @@ -148,4 +149,4 @@ <Target Name="AfterBuild"> </Target> --> -</Project>
\ No newline at end of file +</Project> diff --git a/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/StringAdaptor.cs b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/StringAdaptor.cs new file mode 100644 index 0000000000..022156ea3e --- /dev/null +++ b/extras/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/StringAdaptor.cs @@ -0,0 +1,60 @@ +// +// StringAdaptor.cs +// +// Author: Jeffrey Stedfast <jeff@xamarin.com> +// +// Copyright (c) 2012 Xamarin Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +using System; +using Mono.Debugging.Client; +using Microsoft.Samples.Debugging.CorDebug; +using Mono.Debugging.Evaluation; + +namespace MonoDevelop.Debugger.Win32 +{ + public class StringAdaptor: IStringAdaptor + { + CorEvaluationContext ctx; + CorStringValue str; + CorValRef obj; + + public StringAdaptor (EvaluationContext ctx, CorValRef obj, CorStringValue str) + { + this.ctx = (CorEvaluationContext) ctx; + this.str = str; + this.obj = obj; + } + + public int Length { + get { return str.Length; } + } + + public string Value { + get { return str.String; } + } + + public string Substring (int index, int length) + { + return str.String.Substring (index, length); + } + } +} |