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

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

@ -366,29 +366,49 @@ namespace DebuggerLibrary @@ -366,29 +366,49 @@ namespace DebuggerLibrary
AddScopeToVariableCollection(symRootScope, ref collection);
// Properties
/*
IntPtr methodEnumPtr = IntPtr.Zero;
uint methodsFetched;
while(true) {
uint methodToken;
Module.MetaDataInterface.EnumMethods(ref methodEnumPtr, parentClassToken, out methodToken, 1, out methodsFetched);
if (methodsFetched == 0) break;
uint unused;
uint pStringLenght = 0; // Terminating character included in pStringLenght
IntPtr pString = IntPtr.Zero;
uint attrib;
module.MetaDataInterface.GetMethodProps(
methodToken,
out NDebugger.unused,
NDebugger.pString,
NDebugger.pStringLen,
out NDebugger.unused, // real string lenght
out unused,
pString,
pStringLenght,
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,
IntPtr.Zero,
out NDebugger.unused,
out NDebugger.unused,
out NDebugger.unused);
string name = NDebugger.pStringAsUnicode;
out unused,
out unused,
out unused);
string name = Marshal.PtrToStringUni(pString);
Marshal.FreeHGlobal(pString);
if (name.StartsWith("get_") && (attrib & (uint)CorMethodAttr.mdSpecialName) != 0) {
name = "Prop:" + name;
name = name.Remove(0,4);
ICorDebugValue[] evalArgs;
ICorDebugFunction evalCorFunction;
@ -398,12 +418,11 @@ namespace DebuggerLibrary @@ -398,12 +418,11 @@ namespace DebuggerLibrary
} else {
evalArgs = new ICorDebugValue[] {argThis};
}
Eval eval = new Eval(evalCorFunction, evalArgs);
EvalQueue.AddEval(eval);
collection.Add(new PropertyVariable(eval, name));
Eval eval = new Eval(debugger, evalCorFunction, evalArgs);
//debugger.EvalQueue.AddEval(eval);
//collection.Add(new PropertyVariable(debugger, eval, name));
}
}
*/
}
catch (FrameNotAviableException) {
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 @@ -22,20 +22,20 @@ namespace DebuggerLibrary
bool complete = false;
public event EventHandler EvalComplete;
void OnEvalComplete()
protected virtual void OnEvalComplete(EventArgs e)
{
if (EvalComplete != null) {
EvalComplete(this, EventArgs.Empty);
EvalComplete(this, e);
}
}
}
public Eval(NDebugger debugger, ICorDebugFunction corFunction, ICorDebugValue[] args)
{
this.debugger = debugger;
this.corFunction = corFunction;
this.args = args;
debugger.ManagedCallback.CorDebugEvalCompleted += new CorDebugEvalEventHandler(CorDebugEvalCompleted);
debugger.ManagedCallback.CorDebugEvalCompleted += new CorDebugEvalEventHandler(CorDebugEvalCompletedInManagedCallback);
}
/// <summary>
@ -74,18 +74,11 @@ namespace DebuggerLibrary @@ -74,18 +74,11 @@ namespace DebuggerLibrary
return corValue;
}
protected virtual void OnEvalComplete(EventArgs e)
{
if (EvalComplete != null) {
EvalComplete(this, e);
}
}
void CorDebugEvalCompleted(object sender, CorDebugEvalEventArgs e)
void CorDebugEvalCompletedInManagedCallback(object sender, CorDebugEvalEventArgs e)
{
if (e.CorDebugEval == corEval) {
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 @@ -14,26 +14,26 @@ namespace DebuggerLibrary
{
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);
}
static public void PerformAllEvals()
public void PerformAllEvals()
{
while (waitingEvals.Count > 0) {
PerformNextEval();
}
}
static public void PerformNextEval()
public void PerformNextEval()
{
if (waitingEvals.Count == 0) {
return;
throw new DebuggerException("No eval in queue to perform.");
}
Eval eval = (Eval)waitingEvals[0];
waitingEvals.Remove(eval);

Loading…
Cancel
Save