[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog engine/debugger.c engine/engine....
From: |
Radek Polak |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog engine/debugger.c engine/engine.... |
Date: |
Mon, 02 Apr 2007 21:54:24 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnet
Changes by: Radek Polak <radekp> 07/04/02 21:54:23
Modified files:
. : ChangeLog
engine : debugger.c engine.h jitc.c jitc.h jitc_locals.c
Log message:
implement watching method's parameters and this in instance methods
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3442&r2=1.3443
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/debugger.c?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/engine.h?cvsroot=dotgnu-pnet&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.h?cvsroot=dotgnu-pnet&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_locals.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3442
retrieving revision 1.3443
diff -u -b -r1.3442 -r1.3443
--- ChangeLog 24 Mar 2007 17:54:08 -0000 1.3442
+++ ChangeLog 2 Apr 2007 21:54:23 -0000 1.3443
@@ -1,4 +1,10 @@
-2007-03-24 Radek Polak <address@hidden>
+2007-04-03 Radek Polak <address@hidden>
+
+ * engine/debugger.c, engine/engine.h, engine/jitc.c, engine/jitc.h,
+ engine/jitc_locals.c: Implement watching method's parameters.
+ Implement watching "this" in instance methods.
+
+2007-03-24 Radek Polak <address@hidden>
* engine/debugger.c: Fix local variable index.
Index: engine/debugger.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/debugger.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- engine/debugger.c 24 Mar 2007 17:54:09 -0000 1.18
+++ engine/debugger.c 2 Apr 2007 21:54:23 -0000 1.19
@@ -1083,11 +1083,13 @@
{
#ifdef IL_USE_JIT
ILMethodCode code;
- ILType *signature;
- ILUInt32 num;
- ILUInt32 current;
+ ILType *localSignature;
+ ILType *paramSignature;
+ ILUInt32 currentLocal;
+ ILUInt32 currentParam;
+ ILUInt32 paramDebugIndex;
ILUInt32 i;
- ILLocalWatch *local;
+ ILLocalWatch *watch;
ILType *type;
const char *name = 0;
ILDebugContext *dbgc = 0;
@@ -1095,7 +1097,7 @@
/* Clear locals in helper class */
DebuggerHelper_ClearLocals(thread);
- /* Get local variables info */
+ /* Get locals signature */
if(!ILMethodGetCode(method, &code))
{
DumpError("Unable to get method code", stream);
@@ -1103,16 +1105,17 @@
}
if(code.localVarSig)
{
- signature = ILStandAloneSigGetType(code.localVarSig);
- num = ILTypeNumLocals(signature);
+ localSignature = ILStandAloneSigGetType(code.localVarSig);
}
else
{
- signature = 0;
- num = 0;
+ localSignature = 0;
}
- /* Debug context for local variable names */
+ /* Get params signature */
+ paramSignature = ILMethod_Signature(method);
+
+ /* Debug context for local variable and parameter names */
if(ILDebugPresent(ILProgramItem_Image(method)))
{
/* Get the symbol debug information */
@@ -1122,32 +1125,57 @@
}
}
- /* Add local variables in current frame */
- current = 0;
- for(i = 0; i < thread->numWatches && num > 0; i++)
+ /* Iterate watches in current thread */
+ currentLocal = 0;
+ currentParam = 1;
+ paramDebugIndex = 0;
+ for(i = 0; i < thread->numWatches; i++)
{
- local = &(thread->watchStack[i]);
+ watch = &(thread->watchStack[i]);
/* Skip variables that are not in current frame */
- if(local->frame != thread->frame)
+ if(watch->frame != thread->frame)
{
continue;
}
- type = ILTypeGetLocal(signature, current);
+ if(watch->type == IL_LOCAL_WATCH_TYPE_LOCAL_VAR)
+ {
+ type = ILTypeGetLocal(localSignature, currentLocal);
if(dbgc)
{
name = ILDebugGetVarName(dbgc, ILMethod_Token(method),
offset,
-
current);
+
currentLocal);
if(name == 0)
{
continue;
}
}
- DebuggerHelper_AddLocal(thread, name, type, local->addr);
-
- current++;
- num--;
+ DebuggerHelper_AddLocal(thread, name, type,
watch->addr);
+ currentLocal++;
+ }
+ else if(watch->type == IL_LOCAL_WATCH_TYPE_PARAM)
+ {
+ type = ILTypeGetParam(paramSignature, currentParam);
+ if(dbgc)
+ {
+ name = ILDebugGetVarName(dbgc,
ILMethod_Token(method), offset,
+
paramDebugIndex | 0x80000000);
+ }
+ DebuggerHelper_AddLocal(thread, name, type,
watch->addr);
+ currentParam++;
+ paramDebugIndex++;
+ }
+ else if(watch->type == IL_LOCAL_WATCH_TYPE_THIS)
+ {
+ type = ILType_FromClass(ILMethod_Owner(method));
+ DebuggerHelper_AddLocal(thread, "this", type,
watch->addr);
+ paramDebugIndex++;
+ }
+ else
+ {
+ continue;
+ }
}
if(dbgc)
Index: engine/engine.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- engine/engine.h 17 Mar 2007 19:11:37 -0000 1.121
+++ engine/engine.h 2 Apr 2007 21:54:23 -0000 1.122
@@ -342,10 +342,15 @@
typedef struct _tagILLocalWatch
{
void *addr; /* Address of variable */
- int flag;
+ int type;
void *frame; /* Frame pointer */
} ILLocalWatch;
+
+#define IL_LOCAL_WATCH_TYPE_THIS (0)
+#define IL_LOCAL_WATCH_TYPE_PARAM (1)
+#define IL_LOCAL_WATCH_TYPE_LOCAL_VAR (2)
+
#endif
/*
Index: engine/jitc.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- engine/jitc.c 10 Mar 2007 21:54:57 -0000 1.70
+++ engine/jitc.c 2 Apr 2007 21:54:23 -0000 1.71
@@ -2563,6 +2563,14 @@
}
#ifdef IL_DEBUGGER
+
+/*
+ * Temporary watch marking.
+ */
+#define ILLocalWatchIsInvalid(watch) ((watch)->type & 0x80000000)
+#define ILLocalWatchMarkInvalid(watch) ((watch)->type |= 0x80000000)
+#define ILLocalWatchMarkValid(watch) ((watch)->type &= ~0x80000000)
+
/*
* Drop invalid watches from thread->watchStack.
* Watches are normaly removed on return statement (see handler
@@ -2580,7 +2588,7 @@
for(i = 0; i < thread->numWatches; i++)
{
watch = &(thread->watchStack[i]);
- watch->flag = 1;
+ ILLocalWatchMarkInvalid(watch);
}
/* Find and unmark watches with valid frame pointers */
@@ -2592,8 +2600,7 @@
watch = &(thread->watchStack[i]);
if(watch->frame == frame)
{
- /* Frame is valid */
- watch->flag = 0;
+ ILLocalWatchMarkValid(watch);
}
}
frame = jit_get_next_frame_address(frame);
@@ -2603,7 +2610,7 @@
for(i = thread->numWatches - 1; ((ILInt32)(i)) >= 0; i--)
{
watch = &(thread->watchStack[i]);
- if(watch->flag)
+ if(ILLocalWatchIsInvalid(watch))
{
/* Watch is invalid */
thread->numWatches--;
@@ -2621,6 +2628,8 @@
* data1 data2
meaning
*-----------------------------------------------------------------------------
* METHOD_ENTER ILMethod *
method was called
+ * PARAM_ADDR void *
address of parameter
+ * THIS_ADDR void *
address of "this"
* LOCAL_VAR_ADDR void *
address of local variable
* ILMethod * (method) ILUInt32 (IL offset) soft breakpoint (before
every IL instruction)
* METHOD_LEAVE unused
return from method
@@ -2648,6 +2657,8 @@
}
/* Not reached */
+ case JIT_DEBUGGER_DATA1_THIS_ADDR:
+ case JIT_DEBUGGER_DATA1_PARAM_ADDR:
case JIT_DEBUGGER_DATA1_LOCAL_VAR_ADDR:
{
/* Allocate watch for this local variable */
@@ -2668,6 +2679,19 @@
/* Address is in data2 */
watch->addr = (void *) data2;
+ if(data1 == JIT_DEBUGGER_DATA1_PARAM_ADDR)
+ {
+ watch->type = IL_LOCAL_WATCH_TYPE_PARAM;
+ }
+ else if(data1 == JIT_DEBUGGER_DATA1_LOCAL_VAR_ADDR)
+ {
+ watch->type = IL_LOCAL_WATCH_TYPE_LOCAL_VAR;
+ }
+ else if(data1 == JIT_DEBUGGER_DATA1_THIS_ADDR)
+ {
+ watch->type = IL_LOCAL_WATCH_TYPE_THIS;
+ }
+
thread->numWatches++;
return;
}
Index: engine/jitc.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/jitc.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- engine/jitc.h 28 Nov 2006 19:15:23 -0000 1.21
+++ engine/jitc.h 2 Apr 2007 21:54:23 -0000 1.22
@@ -59,6 +59,12 @@
#define IL_JIT_META_METHODNAME 1001
/*
+ * Definition of flag that is set to 1 if method has this parameter.
+ * Used only when debugging.
+ */
+#define IL_JIT_META_HAS_THIS 1002
+
+/*
* Use the ILMethod * as function pointer.
*/
#define IL_JIT_FNPTR_ILMETHOD 1
@@ -87,7 +93,9 @@
#define JIT_DEBUGGER_DATA1_METHOD_ENTER 0
#define JIT_DEBUGGER_DATA1_METHOD_LEAVE 1
#define JIT_DEBUGGER_DATA1_METHOD_OFFSET 2
-#define JIT_DEBUGGER_DATA1_LOCAL_VAR_ADDR 3
+#define JIT_DEBUGGER_DATA1_THIS_ADDR 3
+#define JIT_DEBUGGER_DATA1_PARAM_ADDR 4
+#define JIT_DEBUGGER_DATA1_LOCAL_VAR_ADDR 5
/*
* Representation of a type representation for libjit.
Index: engine/jitc_locals.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/jitc_locals.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- engine/jitc_locals.c 10 Mar 2007 21:54:57 -0000 1.10
+++ engine/jitc_locals.c 2 Apr 2007 21:54:23 -0000 1.11
@@ -541,6 +541,28 @@
return 1;
}
+#ifdef IL_DEBUGGER
+/*
+ * Create debug mark with local's or parameter's address.
+ */
+static void _ILJitLocalsMarkDebug(ILJITCoder *coder, ILJitValue value,
+ jit_nint type)
+{
+ jit_value_t data1;
+ jit_value_t data2;
+
+ /* Make the variable accessible for debugger */
+ jit_value_set_volatile(value);
+ jit_value_set_addressable(value);
+
+ data1 = jit_value_create_nint_constant(coder->jitFunction,
jit_type_nint,
+
type);
+
+ data2 = jit_insn_address_of(coder->jitFunction, value);
+ jit_insn_mark_breakpoint_variable(coder->jitFunction, data1, data2);
+}
+#endif /* IL_DEBUGGER */
+
/*
* Create the slots for the declared local variables.
* Returns zero if out of memory.
@@ -556,26 +578,15 @@
if(coder->markBreakpoints)
{
ILUInt32 current;
- jit_value_t data1;
- jit_value_t data2;
/* Set the offsets for each of the local variables */
for(current = 0; current < coder->jitLocals.numSlots; ++current)
{
- ILJitLocalSlot *local =
&_ILJitLocalSlotFromSlots(coder->jitLocals, current);
+ ILJitLocalSlot *local =
&_ILJitLocalSlotFromSlots(coder->jitLocals,
+
current);
- /* Notify debugger about address of local variable */
- /* Make the variable accessible for debugger */
- jit_value_set_volatile(local->value);
- jit_value_set_addressable(local->value);
-
- /* Report address of the variable to debugger */
- data1 =
jit_value_create_nint_constant(coder->jitFunction,
-
jit_type_nint,
+ _ILJitLocalsMarkDebug(coder, local->value,
JIT_DEBUGGER_DATA1_LOCAL_VAR_ADDR);
-
- data2 = jit_insn_address_of(coder->jitFunction,
local->value);
- jit_insn_mark_breakpoint_variable(coder->jitFunction,
data1, data2);
}
}
#endif
@@ -598,12 +609,24 @@
static int _ILJitParamsCreate(ILJITCoder *coder)
{
ILJitType signature = jit_function_get_signature(coder->jitFunction);
+#ifdef IL_DEBUGGER
+ int markThis;
+#endif
if(signature)
{
ILJitLocalSlot *param = 0;
ILUInt32 numParams = jit_type_num_params(signature);
+#ifdef IL_DEBUGGER
+ if(coder->markBreakpoints)
+ {
+ markThis = ILType_HasThis(ILMethod_Signature(
+
ILCCtorMgr_GetCurrentMethod(&(coder->cctorMgr))));
+ }
+#endif
+
+
#ifdef IL_JIT_THREAD_IN_SIGNATURE
/* We don't include the ILExecThread in the params. */
if(numParams > 1)
@@ -620,6 +643,24 @@
param->value =
jit_value_get_param(coder->jitFunction, current);
param->flags = 0;
param->refValue = 0;
+
+#ifdef IL_DEBUGGER
+ if(coder->markBreakpoints)
+ {
+ if(markThis)
+ {
+ _ILJitLocalsMarkDebug(coder,
param->value,
+
JIT_DEBUGGER_DATA1_THIS_ADDR);
+ markThis = 0;
+ }
+ else
+ {
+ _ILJitLocalsMarkDebug(coder,
param->value,
+
JIT_DEBUGGER_DATA1_PARAM_ADDR);
+ }
+ }
+#endif
+
}
coder->jitParams.numSlots = numParams - 1;
}
@@ -638,6 +679,20 @@
param->value =
jit_value_get_param(coder->jitFunction, current);
param->flags = 0;
param->refValue = 0;
+
+#ifdef IL_DEBUGGER
+ if(markThis)
+ {
+ _ILJitLocalsMarkDebug(coder,
param->value,
+
JIT_DEBUGGER_DATA1_THIS_ADDR);
+ markThis = 0;
+ }
+ else
+ {
+ _ILJitLocalsMarkDebug(coder,
param->value,
+
JIT_DEBUGGER_DATA1_PARAM_ADDR);
+ }
+#endif
}
coder->jitParams.numSlots = numParams;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog engine/debugger.c engine/engine....,
Radek Polak <=