Browse Source

Bad idea - reverting last two revisions. At least for the time being.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2777 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
f0d97426ff
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs
  2. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  3. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  4. 29
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  5. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
  6. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  7. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  8. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.cs
  9. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs
  11. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs
  12. 84
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs

@ -79,7 +79,7 @@ namespace Debugger @@ -79,7 +79,7 @@ namespace Debugger
public override string Name {
get {
return string.Empty; // TODO
return val.Name;
}
}

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -225,12 +225,13 @@ @@ -225,12 +225,13 @@
<Compile Include="Src\Variables\Types\MemberInfo.cs" />
<Compile Include="Src\Variables\Types\MethodInfo.cs" />
<Compile Include="Src\Variables\Types\PropertyInfo.cs" />
<Compile Include="Src\Variables\Values\ValueCollection.cs" />
<Compile Include="Src\Variables\Values\Value.Array.cs" />
<Compile Include="Src\Variables\Values\Value.Helpers.cs" />
<Compile Include="Src\Variables\Values\Value.Object.cs" />
<Compile Include="Src\Variables\Values\Value.Primitive.cs" />
<Compile Include="Src\Variables\Values\Value.cs" />
<Compile Include="Src\Variables\Values\ValueCollection.cs" />
<Compile Include="Src\Variables\Values\ValueEventArgs.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebug.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebugChainReason.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebugClass.cs" />

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -37,6 +37,7 @@ namespace Debugger @@ -37,6 +37,7 @@ namespace Debugger
corValue = thread.CorThread.CurrentException;
exceptionType = thread.CurrentExceptionType;
Value runtimeValue = new Value(process,
string.Empty,
delegate { return corValue; } );
message = runtimeValue.GetMember("_message").AsString;

29
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -379,6 +379,25 @@ namespace Debugger @@ -379,6 +379,25 @@ namespace Debugger
}
}
/// <summary> Gets value of given name which is accessible from this function </summary>
/// <returns> Null if not found </returns>
public Value GetValue(string name)
{
if (name == "this") {
return ThisValue;
}
if (Arguments.Contains(name)) {
return Arguments[name];
}
if (LocalVariables.Contains(name)) {
return LocalVariables[name];
}
if (ContaingClassVariables.Contains(name)) {
return ContaingClassVariables[name];
}
return null;
}
/// <summary>
/// Gets all variables in the lexical scope of the function.
/// That is, arguments, local variables and varables of the containing class.
@ -418,6 +437,7 @@ namespace Debugger @@ -418,6 +437,7 @@ namespace Debugger
if (thisValueCache == null) {
thisValueCache = new Value(
process,
"this",
delegate { return ThisCorValue; }
);
}
@ -480,8 +500,11 @@ namespace Debugger @@ -480,8 +500,11 @@ namespace Debugger
/// <param name="index"> Zero-based index </param>
public Value GetArgument(int index)
{
string name = GetParameterName(index);
return new Value(
process,
name,
delegate { return GetArgumentCorValue(index); }
);
}
@ -546,8 +569,9 @@ namespace Debugger @@ -546,8 +569,9 @@ namespace Debugger
if (symMethod != null) { // TODO: Is this needed?
ISymUnmanagedScope symRootScope = symMethod.RootScope;
foreach(Value var in GetLocalVariablesInScope(symRootScope)) {
// TODO: Compiler generated variables
yield return var;
if (!var.Name.StartsWith("CS$")) { // TODO: Generalize
yield return var;
}
}
}
}
@ -569,6 +593,7 @@ namespace Debugger @@ -569,6 +593,7 @@ namespace Debugger
{
return new Value(
process,
symVar.Name,
delegate { return GetCorValueOfLocalVariable(symVar); }
);
}

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs

@ -254,7 +254,11 @@ namespace Debugger @@ -254,7 +254,11 @@ namespace Debugger
/// <returns> Null if not found </returns>
public Value GetValue(string name)
{
return null; // TODO
if (SelectedFunction == null || IsRunning) {
return null;
} else {
return SelectedFunction.GetValue(name);
}
}
}
}

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -166,6 +166,7 @@ namespace Debugger @@ -166,6 +166,7 @@ namespace Debugger
return new Value(
process,
string.Empty,
delegate { return CorThread.Object;}
);
}

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs

@ -233,6 +233,7 @@ namespace Debugger @@ -233,6 +233,7 @@ namespace Debugger
state = EvalState.EvaluatedException;
}
result = new Value(process,
string.Empty,
delegate { return corEval.Result; });
}
}

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.cs

@ -64,16 +64,6 @@ namespace Debugger @@ -64,16 +64,6 @@ namespace Debugger
return this.Code;
}
static string GetNameFromIndices(uint[] indices)
{
string elementName = "[";
for (int i = 0; i < indices.Length; i++) {
elementName += indices[i].ToString() + ",";
}
elementName = elementName.TrimEnd(new char[] {','}) + "]";
return elementName;
}
Expression GetExpressionFromIndices(uint[] indices)
{
List<Ast.Expression> indicesAst = new List<Ast.Expression>();

11
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs

@ -76,10 +76,21 @@ namespace Debugger @@ -76,10 +76,21 @@ namespace Debugger
return new Value(
Process,
GetNameFromIndices(indices),
delegate { return GetCorValueOfArrayElement(indices); }
);
}
static string GetNameFromIndices(uint[] indices)
{
string elementName = "[";
for (int i = 0; i < indices.Length; i++) {
elementName += indices[i].ToString() + ",";
}
elementName = elementName.TrimEnd(new char[] {','}) + "]";
return elementName;
}
// May be called later
ICorDebugValue GetCorValueOfArrayElement(uint[] indices)
{

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs

@ -49,6 +49,7 @@ namespace Debugger @@ -49,6 +49,7 @@ namespace Debugger
{
return new Value(
objectInstance.Process,
fieldInfo.Name,
delegate { return GetFieldCorValue(objectInstance, fieldInfo); }
);
}
@ -110,6 +111,7 @@ namespace Debugger @@ -110,6 +111,7 @@ namespace Debugger
return new Value(
objectInstance.Process,
propertyInfo.Name,
delegate { return Value.InvokeMethod(objectInstance, propertyInfo.GetMethod, arguments).RawCorValue; }
);
}

21
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs

@ -36,6 +36,7 @@ namespace Debugger @@ -36,6 +36,7 @@ namespace Debugger
/// </remarks>
public partial class Value: DebuggerObject, IExpirable
{
string name;
Process process;
CorValueGetter corValueGetter;
@ -81,12 +82,20 @@ namespace Debugger @@ -81,12 +82,20 @@ namespace Debugger
if (IsPrimitive) cache.AsString = PrimitiveValue != null ? PrimitiveValue.ToString() : String.Empty;
TimeSpan totalTime = Util.HighPrecisionTimer.Now - startTime;
process.TraceMessage("Obtained value: " + cache.AsString + " (" + totalTime.TotalMilliseconds + " ms)");
string name = this is Value ? ((Value)this).Name + " = " : String.Empty;
process.TraceMessage("Obtained value: " + name + cache.AsString + " (" + totalTime.TotalMilliseconds + " ms)");
}
return cache;
}
}
/// <summary> Gets the name associated with the value </summary>
public string Name {
get {
return name;
}
}
/// <summary> Returns true if the value is null </summary>
public bool IsNull {
get {
@ -157,11 +166,21 @@ namespace Debugger @@ -157,11 +166,21 @@ namespace Debugger
}
internal Value(Process process,
string name,
CorValueGetter corValueGetter)
{
this.process = process;
this.name = name;
this.corValueGetter = corValueGetter;
// TODO: clean up
if (name.StartsWith("<") && name.Contains(">") && name != "<Base class>") {
string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>'
if (middle != "") {
this.name = middle;
}
}
process.DebuggingResumed += delegate {
this.isExpired = true;
OnExpired(EventArgs.Empty);

84
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs

@ -12,15 +12,89 @@ using System.Collections.Generic; @@ -12,15 +12,89 @@ using System.Collections.Generic;
namespace Debugger
{
/// <summary>
/// An enumerable collection of values
/// An enumerable collection of values accessible by name.
/// </summary>
public class ValueCollection: List<Value>
public class ValueCollection: DebuggerObject, IEnumerable<Value>, IEnumerable
{
public static ValueCollection Empty = new ValueCollection(new Value[0]);
internal static ValueCollection Empty = new ValueCollection(new Value[0]);
public ValueCollection(IEnumerable<Value> values):base(values)
List<Value> list = new List<Value>();
Dictionary<string, List<Value>> hashtable = new Dictionary<string, List<Value>>();
IEnumerator<Value> IEnumerable<Value>.GetEnumerator()
{
foreach(Value namedValue in list) {
yield return namedValue;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
foreach(Value namedValue in list) {
yield return namedValue;
}
}
internal ValueCollection(IEnumerable<Value> namedValues)
{
foreach(Value namedValue in namedValues) {
string name = namedValue.Name;
if (hashtable.ContainsKey(name)) {
hashtable[name].Add(namedValue);
} else {
hashtable[name] = new List<Value>(new Value[] {namedValue});
}
list.Add(namedValue);
}
}
/// <summary>
/// Gets a value indicating whether the collection contains a
/// value with a given name
/// </summary>
public bool Contains(string name)
{
return hashtable.ContainsKey(name);
}
/// <summary>
/// Gets number of <see cref="Debugger.NamedValue">named values</see> contained in the collection
/// </summary>
public int Count {
get {
return list.Count;
}
}
/// <summary>
/// Gets a value by index
/// </summary>
public Value this[int i] {
get {
return list[i];
}
}
/// <summary>
/// Gets a value by its name.
/// </summary>
public Value this[string variableName] {
get {
if (hashtable.ContainsKey(variableName)) {
foreach(Value val in hashtable[variableName]) {
return val;
}
}
// int index = variableName.IndexOf('.');
// if (index != -1) {
// string rootVariable = variableName.Substring(0, index);
// string subVariable = variableName.Substring(index + 1);
// return this[rootVariable].Value.SubVariables[subVariable];
// }
throw new DebuggerException("Variable \"" + variableName + "\" is not in collection");
}
}
}
}

Loading…
Cancel
Save