|
From: Tom H. <th...@cy...> - 2004-10-07 08:34:46
|
CVS commit by thughes:
More fixes for stabs generated by the GNAT compiler. This patch
allows negative offsets in structure member definitions as well as
improving the previous fix for names that are declared as both struct
tags and typedefs.
CCMAIL: 901...@bu...
M +19 -7 vg_stabs.c 1.19
--- valgrind/coregrind/vg_stabs.c #1.18:1.19
@@ -172,4 +172,13 @@ static SymType *structDef(StabTypeTab *t
SymType *ref = structRef(tab, NULL, isstruct, name);
+ /* it seems that GNAT likes to declare names as both struct tags
+ and typedefs so check we aren't about to make a structure a
+ reference to itself as that will create a loop */
+ if (ref == def) {
+ if (debug)
+ VG_(printf)("ignoring %s self ref for %s %p -> %p\n",
+ isstruct ? "struct" : "union", name, ref, def);
+ }
+ else {
if (debug)
VG_(printf)("defining %s ref for %s %p -> %p\n",
@@ -178,4 +187,5 @@ static SymType *structDef(StabTypeTab *t
def = VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False));
VG_(st_setname)(def, name);
+ }
return def;
}
@@ -941,5 +951,8 @@ static SymType *stabtype_parser(SegInfo
EXPECT(',', "struct TYPE");
- off = atou(&p, 0);
+ /* logic dictates that the offset would always be
+ positive and that atou would work here but GNAT has
+ has other ideas - see bug 90128 for more details */
+ off = atoi(&p, 0);
if (*p == ',') {
@@ -1092,5 +1105,4 @@ static Bool initSym(SegInfo *si, Sym *sy
out:
- if (isStruct && isTypedef) isStruct = False;
sym->type = stabtype_parser(si, NULL, &ty);
base = VG_(st_basetype)(sym->type, False);
|