Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2023 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
11 changed files with 500 additions and 508 deletions
@ -0,0 +1,93 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using Debugger.Wrappers.CorDebug; |
||||||
|
|
||||||
|
namespace Debugger |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Provides more specific access
|
||||||
|
/// </summary>
|
||||||
|
public abstract class ValueProxy: RemotingObjectBase |
||||||
|
{ |
||||||
|
Value val; |
||||||
|
|
||||||
|
public Value TheValue { |
||||||
|
get { |
||||||
|
return val; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public abstract string AsString { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
public virtual string Type { |
||||||
|
get{ |
||||||
|
return Value.CorTypeToString(TheValue.CorType); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public virtual Type ManagedType { |
||||||
|
get { |
||||||
|
return Value.CorTypeToManagedType(TheValue.CorType); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool MayHaveSubVariables { |
||||||
|
get { |
||||||
|
#if DEBUG
|
||||||
|
return true; |
||||||
|
#else
|
||||||
|
return GetMayHaveSubVariables(); |
||||||
|
#endif
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract bool GetMayHaveSubVariables(); |
||||||
|
|
||||||
|
public VariableCollection SubVariables { |
||||||
|
get { |
||||||
|
VariableCollection subVars = GetSubVariables(); |
||||||
|
#if DEBUG
|
||||||
|
return new VariableCollection(subVars.Name, |
||||||
|
subVars.Value, |
||||||
|
Util.MergeLists(val.GetDebugInfo(), subVars.SubCollections).ToArray(), |
||||||
|
subVars.Items); |
||||||
|
#else
|
||||||
|
return subVars; |
||||||
|
#endif
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual VariableCollection GetSubVariables() |
||||||
|
{ |
||||||
|
return new VariableCollection(new Variable[] {}); |
||||||
|
} |
||||||
|
|
||||||
|
public Variable this[string variableName] { |
||||||
|
get { |
||||||
|
foreach(Variable v in SubVariables) { |
||||||
|
if (v.Name == variableName) return v; |
||||||
|
} |
||||||
|
throw new DebuggerException("Subvariable " + variableName + " does not exist"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected ValueProxy(Value @value) |
||||||
|
{ |
||||||
|
if (@value == null) throw new ArgumentNullException("value"); |
||||||
|
this.val = @value; |
||||||
|
} |
||||||
|
|
||||||
|
public override string ToString() |
||||||
|
{ |
||||||
|
return AsString; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,91 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
|
|
||||||
using Debugger.Wrappers.CorDebug; |
|
||||||
|
|
||||||
namespace Debugger |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Variable: IExpirable, IMutable |
|
||||||
{ |
|
||||||
string name; |
|
||||||
Value val; |
|
||||||
bool hasExpired; |
|
||||||
|
|
||||||
public event EventHandler Expired; |
|
||||||
public event EventHandler<ProcessEventArgs> Changed; |
|
||||||
|
|
||||||
public Process Process { |
|
||||||
get { |
|
||||||
return val.Process; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public string Name { |
|
||||||
get { |
|
||||||
return name; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Value Value { |
|
||||||
get { |
|
||||||
return val; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public ValueProxy ValueProxy { |
|
||||||
get { |
|
||||||
return val.ValueProxy; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public bool HasExpired { |
|
||||||
get { |
|
||||||
return hasExpired; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
internal Variable(string name, Value @value) |
|
||||||
{ |
|
||||||
if (@value == null) throw new ArgumentNullException("value"); |
|
||||||
|
|
||||||
this.name = name; |
|
||||||
this.val = @value; |
|
||||||
this.val.Expired += delegate(object sender, EventArgs e) { OnExpired(e); }; |
|
||||||
this.val.Changed += delegate(object sender, ProcessEventArgs e) { OnChanged(e); }; |
|
||||||
|
|
||||||
if (name.StartsWith("<") && name.Contains(">") && name != "<Base class>") { |
|
||||||
string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>'
|
|
||||||
if (middle != "") { |
|
||||||
this.name = middle; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
protected virtual void OnExpired(EventArgs e) |
|
||||||
{ |
|
||||||
if (!hasExpired) { |
|
||||||
hasExpired = true; |
|
||||||
if (Expired != null) { |
|
||||||
Expired(this, e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
protected virtual void OnChanged(ProcessEventArgs e) |
|
||||||
{ |
|
||||||
if (Changed != null) { |
|
||||||
Changed(this, e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue