|
|
|
@ -114,7 +114,7 @@ namespace Debugger
@@ -114,7 +114,7 @@ namespace Debugger
|
|
|
|
|
public bool IsInvalid { |
|
|
|
|
get { |
|
|
|
|
return corValue_pauseSession != this.Process.PauseSession && |
|
|
|
|
!(corValue is ICorDebugHandleValue); |
|
|
|
|
!(corValue is ICorDebugHandleValue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -149,12 +149,23 @@ namespace Debugger
@@ -149,12 +149,23 @@ namespace Debugger
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> Gets a string representation of the value </summary>
|
|
|
|
|
public string AsString { |
|
|
|
|
get { |
|
|
|
|
if (this.IsNull) return "null"; |
|
|
|
|
if (this.Type.IsPrimitive) return PrimitiveValue.ToString(); |
|
|
|
|
if (this.Type.FullName == typeof(string).FullName) return PrimitiveValue.ToString(); |
|
|
|
|
return "{" + this.Type.FullName + "}"; |
|
|
|
|
/// <param name="maxLength">
|
|
|
|
|
/// The maximum length of the result string.
|
|
|
|
|
/// </param>
|
|
|
|
|
public string AsString(int maxLength = int.MaxValue) |
|
|
|
|
{ |
|
|
|
|
if (this.IsNull) return "null"; |
|
|
|
|
if (this.Type.IsPrimitive || this.Type.FullName == typeof(string).FullName) { |
|
|
|
|
string text = PrimitiveValue.ToString(); |
|
|
|
|
if (text != null && text.Length > maxLength) |
|
|
|
|
text = text.Substring(0, Math.Max(0, maxLength - 3)) + "..."; |
|
|
|
|
return text; |
|
|
|
|
} else { |
|
|
|
|
string name = this.Type.FullName; |
|
|
|
|
if (name != null && name.Length > maxLength) |
|
|
|
|
return "{" + name.Substring(0, Math.Max(0, maxLength - 5)) + "...}"; |
|
|
|
|
else |
|
|
|
|
return "{" + name + "}"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -600,14 +611,14 @@ namespace Debugger
@@ -600,14 +611,14 @@ namespace Debugger
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> Invoke the ToString() method </summary>
|
|
|
|
|
public string InvokeToString() |
|
|
|
|
public string InvokeToString(int maxLength = int.MaxValue) |
|
|
|
|
{ |
|
|
|
|
if (this.Type.IsPrimitive) return AsString; |
|
|
|
|
if (this.Type.FullName == typeof(string).FullName) return AsString; |
|
|
|
|
if (this.Type.IsPrimitive) return AsString(maxLength); |
|
|
|
|
if (this.Type.FullName == typeof(string).FullName) return AsString(maxLength); |
|
|
|
|
if (this.Type.IsPointer) return "0x" + this.PointerAddress.ToString("X"); |
|
|
|
|
// if (!IsObject) // Can invoke on primitives
|
|
|
|
|
DebugMethodInfo methodInfo = (DebugMethodInfo)this.AppDomain.ObjectType.GetMethod("ToString", new DebugType[] {}); |
|
|
|
|
return Eval.InvokeMethod(methodInfo, this, new Value[] {}).AsString; |
|
|
|
|
return Eval.InvokeMethod(methodInfo, this, new Value[] {}).AsString(maxLength); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region Convenience overload methods
|
|
|
|
@ -636,9 +647,7 @@ namespace Debugger
@@ -636,9 +647,7 @@ namespace Debugger
|
|
|
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
|
{ |
|
|
|
|
return this.AsString; |
|
|
|
|
return this.AsString(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|