+2004-05-14 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+ * src/SDCCdwarf2.c (dwMatchTypes): structs must have matching
+ SPEC_STRUCT
+ * src/SDCCdwarf2.c (dwTagFromType): fix to handle recursive
+ struct definitions
+ * src/SDCCdwarf2.c (dwWriteModule, dwNewDebugSymbol, dwWriteEndFunction,
+ dwWriteLabel): fix to create valid debugger symbols even when
+ the module name has non-alphanumeric symbols in it
+ * src/SDCCdwarf2.c (dwWriteSymbolInternal): better detection for
+ when a variable's allocation has been optimized away
+
+
2004-05-13 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
* src/hc08/gen.c (hc08_emitDebuggerSymbol),
{
char debugSym[SDCC_NAME_MAX];
- sprintf (debugSym, "S%s$%s$%d", moduleName, currFunc->name, dwDebugSymbol);
+ sprintf (debugSym, "S%s$%s$%d", dwModuleName, currFunc->name, dwDebugSymbol);
dwDebugSymbol++;
return Safe_strdup (debugSym);
}
{
if (SPEC_NOUN (type1) != SPEC_NOUN (type2))
return 0;
+ if (SPEC_NOUN (type1) == V_STRUCT
+ && SPEC_STRUCT (type1) != SPEC_STRUCT (type2))
+ return 0;
if (SPEC_CONST (type1) != SPEC_CONST (type2))
return 0;
if (SPEC_VOLATILE (type1) != SPEC_VOLATILE (type2))
dwtag * modtp;
dwtag * subtp;
int key;
+ int tableUpdated = 0;
key = dwHashType (type) % dwTypeTagTable->size;
oldtp = hTabFindByKey (dwTypeTagTable, key, type, dwMatchTypes);
/* is a complete type */
dwAddTagAttr (tp, dwNewAttrConst (DW_AT_byte_size,
getSize (type)));
+
+ /* Must add this before processing the struct fields */
+ /* in case there is a recursive definition. */
+ hTabAddItemLong (&dwTypeTagTable, key, type, tp);
+ tableUpdated = 1;
+
field = sdp->fields;
while (field)
{
}
}
- hTabAddItemLong (&dwTypeTagTable, key, type, tp);
+ if (!tableUpdated)
+ hTabAddItemLong (&dwTypeTagTable, key, type, tp);
+ if (!tp->parent)
+ dwAddTagChild (parent, tp);
return tp;
}
/*------------------------------------------------------------------------*/
else if (symloc->onStack)
{
/* stack allocation */
- lp = dwNewLoc (DW_OP_fbreg, NULL, sym->stack);
+ lp = dwNewLoc (DW_OP_fbreg, NULL, symloc->stack);
}
else
{
/* global allocation */
- lp = dwNewLoc (DW_OP_addr, sym->rname, 0);
+ if (sym->level && !sym->allocreq)
+ lp = NULL;
+ else
+ lp = dwNewLoc (DW_OP_addr, symloc->rname, 0);
}
/* Only create the DW_AT_location if a known location exists. */
}
if (IS_STATIC (sym->etype))
- sprintf (debugSym, "XF%s$%s$0$0", moduleName, sym->name);
+ sprintf (debugSym, "XF%s$%s$0$0", dwModuleName, sym->name);
else
sprintf (debugSym, "XG$%s$0$0", sym->name);
emitDebuggerSymbol (debugSym);
if (sym->isitmp)
return 1;
- sprintf (debugSym, "L%s$%s$%s", moduleName, currFunc->name, sym->name);
+ sprintf (debugSym, "L%s$%s$%s", dwModuleName, currFunc->name, sym->name);
emitDebuggerSymbol (debugSym);
tp = dwNewTag (DW_TAG_label);
int dwWriteModule(char *name)
{
dwtag * tp;
+ char * s;
if(!dwarf2FilePtr) return 0;
+ dwModuleName = Safe_strdup (name);
+ for (s = dwModuleName; *s; s++)
+ if (ispunct (*s) || isspace (*s))
+ *s = '_';
+
tp = dwNewTag (DW_TAG_compile_unit);
dwAddTagAttr (tp, dwNewAttrString (DW_AT_producer, "SDCC version "
SDCC_VERSION_STR));