Browse Source

A bit work on properties

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@186 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
d110f9161e
  1. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  2. 49
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  3. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  4. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/EvalQueue.cs

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -26,6 +26,14 @@ namespace DebuggerLibrary
ApartmentState requiredApartmentState; ApartmentState requiredApartmentState;
EvalQueue evalQueue = new EvalQueue();
internal EvalQueue EvalQueue {
get {
return evalQueue;
}
}
public ApartmentState RequiredApartmentState { public ApartmentState RequiredApartmentState {
get { get {
return requiredApartmentState; return requiredApartmentState;
@ -108,6 +116,8 @@ namespace DebuggerLibrary
ClearThreads(); ClearThreads();
CurrentProcess = null; CurrentProcess = null;
evalQueue = new EvalQueue();
GC.Collect(GC.MaxGeneration); GC.Collect(GC.MaxGeneration);
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();

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

@ -366,29 +366,49 @@ namespace DebuggerLibrary
AddScopeToVariableCollection(symRootScope, ref collection); AddScopeToVariableCollection(symRootScope, ref collection);
// Properties // Properties
/*
IntPtr methodEnumPtr = IntPtr.Zero; IntPtr methodEnumPtr = IntPtr.Zero;
uint methodsFetched; uint methodsFetched;
while(true) { while(true) {
uint methodToken; uint methodToken;
Module.MetaDataInterface.EnumMethods(ref methodEnumPtr, parentClassToken, out methodToken, 1, out methodsFetched); Module.MetaDataInterface.EnumMethods(ref methodEnumPtr, parentClassToken, out methodToken, 1, out methodsFetched);
if (methodsFetched == 0) break; if (methodsFetched == 0) break;
uint unused;
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
uint attrib; uint attrib;
module.MetaDataInterface.GetMethodProps( module.MetaDataInterface.GetMethodProps(
methodToken, methodToken,
out NDebugger.unused, out unused,
NDebugger.pString, pString,
NDebugger.pStringLen, pStringLenght,
out NDebugger.unused, // real string lenght out pStringLenght, // real string lenght
out attrib,
IntPtr.Zero,
out unused,
out unused,
out unused);
// Allocate string buffer
pString = Marshal.AllocHGlobal((int)pStringLenght * 2);
module.MetaDataInterface.GetMethodProps(
methodToken,
out unused,
pString,
pStringLenght,
out pStringLenght, // real string lenght
out attrib, out attrib,
IntPtr.Zero, IntPtr.Zero,
out NDebugger.unused, out unused,
out NDebugger.unused, out unused,
out NDebugger.unused); out unused);
string name = NDebugger.pStringAsUnicode;
string name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
if (name.StartsWith("get_") && (attrib & (uint)CorMethodAttr.mdSpecialName) != 0) { if (name.StartsWith("get_") && (attrib & (uint)CorMethodAttr.mdSpecialName) != 0) {
name = "Prop:" + name; name = name.Remove(0,4);
ICorDebugValue[] evalArgs; ICorDebugValue[] evalArgs;
ICorDebugFunction evalCorFunction; ICorDebugFunction evalCorFunction;
@ -398,12 +418,11 @@ namespace DebuggerLibrary
} else { } else {
evalArgs = new ICorDebugValue[] {argThis}; evalArgs = new ICorDebugValue[] {argThis};
} }
Eval eval = new Eval(evalCorFunction, evalArgs); Eval eval = new Eval(debugger, evalCorFunction, evalArgs);
EvalQueue.AddEval(eval); //debugger.EvalQueue.AddEval(eval);
collection.Add(new PropertyVariable(eval, name)); //collection.Add(new PropertyVariable(debugger, eval, name));
} }
} }
*/
} }
catch (FrameNotAviableException) { catch (FrameNotAviableException) {
System.Diagnostics.Debug.Fail("Unable to get local variables. Frame is not aviable"); System.Diagnostics.Debug.Fail("Unable to get local variables. Frame is not aviable");

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

@ -22,20 +22,20 @@ namespace DebuggerLibrary
bool complete = false; bool complete = false;
public event EventHandler EvalComplete; public event EventHandler EvalComplete;
void OnEvalComplete() protected virtual void OnEvalComplete(EventArgs e)
{ {
if (EvalComplete != null) { if (EvalComplete != null) {
EvalComplete(this, EventArgs.Empty); EvalComplete(this, e);
} }
} }
public Eval(NDebugger debugger, ICorDebugFunction corFunction, ICorDebugValue[] args) public Eval(NDebugger debugger, ICorDebugFunction corFunction, ICorDebugValue[] args)
{ {
this.debugger = debugger; this.debugger = debugger;
this.corFunction = corFunction; this.corFunction = corFunction;
this.args = args; this.args = args;
debugger.ManagedCallback.CorDebugEvalCompleted += new CorDebugEvalEventHandler(CorDebugEvalCompleted); debugger.ManagedCallback.CorDebugEvalCompleted += new CorDebugEvalEventHandler(CorDebugEvalCompletedInManagedCallback);
} }
/// <summary> /// <summary>
@ -74,18 +74,11 @@ namespace DebuggerLibrary
return corValue; return corValue;
} }
protected virtual void OnEvalComplete(EventArgs e) void CorDebugEvalCompletedInManagedCallback(object sender, CorDebugEvalEventArgs e)
{
if (EvalComplete != null) {
EvalComplete(this, e);
}
}
void CorDebugEvalCompleted(object sender, CorDebugEvalEventArgs e)
{ {
if (e.CorDebugEval == corEval) { if (e.CorDebugEval == corEval) {
complete = true; complete = true;
OnEvalComplete(); OnEvalComplete(EventArgs.Empty);
} }
} }
} }

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/EvalQueue.cs

@ -14,26 +14,26 @@ namespace DebuggerLibrary
{ {
class EvalQueue class EvalQueue
{ {
static ArrayList waitingEvals = new ArrayList(); ArrayList waitingEvals = new ArrayList();
public static event EventHandler AllEvalsComplete; public event EventHandler AllEvalsComplete;
static public void AddEval(Eval eval) public void AddEval(Eval eval)
{ {
waitingEvals.Add(eval); waitingEvals.Add(eval);
} }
static public void PerformAllEvals() public void PerformAllEvals()
{ {
while (waitingEvals.Count > 0) { while (waitingEvals.Count > 0) {
PerformNextEval(); PerformNextEval();
} }
} }
static public void PerformNextEval() public void PerformNextEval()
{ {
if (waitingEvals.Count == 0) { if (waitingEvals.Count == 0) {
return; throw new DebuggerException("No eval in queue to perform.");
} }
Eval eval = (Eval)waitingEvals[0]; Eval eval = (Eval)waitingEvals[0];
waitingEvals.Remove(eval); waitingEvals.Remove(eval);

Loading…
Cancel
Save