[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/ilasm ilasm_grammar.y, 1.36, 1.37 ilasm_
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/ilasm ilasm_grammar.y, 1.36, 1.37 ilasm_output.c, 1.17, 1.18 ilasm_output.h, 1.7, 1.8 |
Date: |
Mon, 14 Jul 2003 07:31:36 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/ilasm
In directory subversions:/tmp/cvs-serv11182/ilasm
Modified Files:
ilasm_grammar.y ilasm_output.c ilasm_output.h
Log Message:
Modify the assembler so that it can output debug information
for local variable names and their scopes.
Index: ilasm_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_grammar.y,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** ilasm_grammar.y 6 May 2003 09:53:21 -0000 1.36
--- ilasm_grammar.y 14 Jul 2003 11:31:34 -0000 1.37
***************
*** 2163,2166 ****
--- 2163,2170 ----
ILAsmOutAddLocals($4.paramFirst);
}
+ | D_LOCALS '<' Identifier '=' Integer32 '>' {
+ /* Extension for use with "cscc": declare a
variable name */
+ ILAsmOutDeclareVarName($3.string,
(ILUInt32)($5));
+ }
| D_ENTRYPOINT { ILWriterSetEntryPoint
(ILAsmWriter, (ILMethod *)ILAsmCurrScope); }
***************
*** 2272,2275 ****
--- 2276,2280 ----
/* Record the start of the block */
$<scope>$.start = ILAsmOutUniqueLabel();
+ ILAsmOutPushVarScope($<scope>$.start);
}
ScopeDeclarations '}' {
***************
*** 2277,2280 ****
--- 2282,2286 ----
$$.start = $<scope>2.start;
$$.end = ILAsmOutUniqueLabel();
+ ILAsmOutPopVarScope($$.end);
}
;
Index: ilasm_output.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_output.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** ilasm_output.c 10 Mar 2003 20:52:32 -0000 1.17
--- ilasm_output.c 14 Jul 2003 11:31:34 -0000 1.18
***************
*** 58,63 ****
--- 58,72 ----
static int initLocals = 0;
static ILUInt32 localIndex = 0;
+ typedef struct _tagLocalBlock
+ {
+ char *blockStart;
+ char *blockEnd;
+ struct _tagLocalBlock *outer;
+ struct _tagLocalBlock *next;
+
+ } LocalBlock;
typedef struct _tagLocalInfo
{
+ LocalBlock *block;
char *name;
ILUInt32 index;
***************
*** 66,69 ****
--- 75,80 ----
} LocalInfo;
static LocalInfo *localNames = 0;
+ static LocalBlock *localBlocks = 0;
+ static LocalBlock *localCurrentBlock = 0;
static ILAsmOutException *exceptionList = 0;
static ILAsmOutException *lastException = 0;
***************
*** 254,257 ****
--- 265,269 ----
{
LocalInfo *local, *nextLocal;
+ LocalBlock *block, *nextBlock;
ILAsmOutException *exception, *nextException;
***************
*** 272,275 ****
--- 284,294 ----
local = nextLocal;
}
+ block = localBlocks;
+ while(block != 0)
+ {
+ nextBlock = block->next;
+ ILFree(block);
+ block = nextBlock;
+ }
exception = exceptionList;
while(exception != 0)
***************
*** 294,297 ****
--- 313,317 ----
localIndex = 0;
localNames = 0;
+ localBlocks = 0;
exceptionList = 0;
lastException = 0;
***************
*** 1348,1351 ****
--- 1368,1372 ----
ILAsmOutOfMemory();
}
+ local->block = localCurrentBlock;
local->name = name;
local->index = index;
***************
*** 1675,1679 ****
LabelInfo *label = labels;
unsigned long len = 0;
! int type = IL_DEBUGTYPE_LINE_OFFSETS;
if(haveColumnInfo)
{
--- 1696,1705 ----
LabelInfo *label = labels;
unsigned long len = 0;
! int type;
! LocalInfo *local;
! LocalBlock *lastBlock;
!
! /* Output the line number information for the method */
! type = IL_DEBUGTYPE_LINE_OFFSETS;
if(haveColumnInfo)
{
***************
*** 1722,1725 ****
--- 1748,1797 ----
ILWriterDebugAdd(ILAsmWriter, (ILProgramItem *)method,
type, buf, len);
+ len = 0;
+ }
+
+ /* Output the local variable name information for the method */
+ local = localNames;
+ lastBlock = (LocalBlock *)(ILNativeInt)(-1);
+ type = IL_DEBUGTYPE_VARS;
+ while(local != 0)
+ {
+ if(!len || len >= (sizeof(buf) - IL_META_COMPRESS_MAX_SIZE * 4)
||
+ local->block != lastBlock)
+ {
+ /* We've encountered a change in local variable scope,
+ or the buffer is almost full */
+ if(len > 0)
+ {
+ ILWriterDebugAdd(ILAsmWriter, (ILProgramItem
*)method,
+ type, buf,
len);
+ len = 0;
+ }
+ lastBlock = local->block;
+ if(!lastBlock)
+ {
+ /* Outermost local variable scope for the
method */
+ type = IL_DEBUGTYPE_VARS;
+ }
+ else
+ {
+ /* Inner local variable scope for the method */
+ type = IL_DEBUGTYPE_VARS_OFFSETS;
+ label = GetLabel(lastBlock->blockStart);
+ len += ILMetaCompressData(buf + len,
label->address);
+ label = GetLabel(lastBlock->blockEnd);
+ len += ILMetaCompressData(buf + len,
label->address);
+ }
+ }
+ len += ILMetaCompressData
+ (buf + len, ILWriterDebugString(ILAsmWriter,
local->name));
+ len += ILMetaCompressData(buf + len, local->index);
+ local = local->next;
+ }
+ if(len > 0)
+ {
+ /* Flush the remainder of the debug information */
+ ILWriterDebugAdd(ILAsmWriter, (ILProgramItem *)method,
+ type, buf, len);
}
}
***************
*** 1732,1735 ****
--- 1804,1809 ----
LocalInfo *local;
LocalInfo *nextLocal;
+ LocalBlock *block;
+ LocalBlock *nextBlock;
ILAsmOutException *exception;
ILAsmOutException *nextException;
***************
*** 2062,2065 ****
--- 2136,2147 ----
}
localNames = 0;
+ block = localBlocks;
+ while(block != 0)
+ {
+ nextBlock = block->next;
+ ILFree(block);
+ block = nextBlock;
+ }
+ localBlocks = 0;
exception = exceptionList;
while(exception != 0)
***************
*** 2130,2133 ****
--- 2212,2244 ----
{
ILAsmOutOfMemory();
+ }
+ }
+
+ void ILAsmOutDeclareVarName(char *name, ILUInt32 index)
+ {
+ AddLocalName(name, index);
+ }
+
+ void ILAsmOutPushVarScope(char *name)
+ {
+ LocalBlock *block = (LocalBlock *)ILMalloc(sizeof(LocalBlock));
+ if(!block)
+ {
+ ILAsmOutOfMemory();
+ }
+ block->blockStart = name;
+ block->blockEnd = 0;
+ block->outer = localCurrentBlock;
+ block->next = localBlocks;
+ localBlocks = block;
+ localCurrentBlock = block;
+ }
+
+ void ILAsmOutPopVarScope(char *name)
+ {
+ if(localCurrentBlock)
+ {
+ localCurrentBlock->blockEnd = name;
+ localCurrentBlock = localCurrentBlock->outer;
}
}
Index: ilasm_output.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_output.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** ilasm_output.h 10 Mar 2003 20:52:32 -0000 1.7
--- ilasm_output.h 14 Jul 2003 11:31:34 -0000 1.8
***************
*** 234,237 ****
--- 234,252 ----
/*
+ * Declare a local variable name for debug symbol information.
+ */
+ void ILAsmOutDeclareVarName(char *name, ILUInt32 index);
+
+ /*
+ * Push into a nested local variable scope.
+ */
+ void ILAsmOutPushVarScope(char *name);
+
+ /*
+ * Pop out of a nested local variable scope.
+ */
+ void ILAsmOutPopVarScope(char *name);
+
+ /*
* Initialize the constant pool attached to the current class
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/ilasm ilasm_grammar.y, 1.36, 1.37 ilasm_output.c, 1.17, 1.18 ilasm_output.h, 1.7, 1.8,
Rhys Weatherley <address@hidden> <=