From: Tom Hughes Date: Thu, 4 Nov 2004 13:24:33 +0000 (+0000) Subject: Fix some GNAT related stabs parsing problems. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06fd16ba0dd800dbb8ce452375ef7175ac434600;p=thirdparty%2Fvalgrind.git Fix some GNAT related stabs parsing problems. MERGE TO STABLE git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@2913 --- diff --git a/coregrind/vg_stabs.c b/coregrind/vg_stabs.c index a815f174fd..970a6bac31 100644 --- a/coregrind/vg_stabs.c +++ b/coregrind/vg_stabs.c @@ -170,12 +170,22 @@ static SymType *structDef(StabTypeTab *tab, SymType *def, Bool isstruct, Char *n static const Bool debug = False; SymType *ref = structRef(tab, NULL, isstruct, name); - if (debug) - VG_(printf)("defining %s ref for %s %p -> %p\n", - isstruct ? "struct" : "union", name, ref, def); - - def = VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False)); - VG_(st_setname)(def, 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", + isstruct ? "struct" : "union", name, ref, def); + + def = VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False)); + VG_(st_setname)(def, name); + } return def; } @@ -939,7 +949,10 @@ static SymType *stabtype_parser(SegInfo *si, SymType *def, Char **pp) } else { 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 == ',') { EXPECT(',', "struct OFFSET");