Article View: gnu.gdb.bug
Article #288spurious warning in dbxread.c
From: Adam de Boor
Date: Sat, 07 Oct 1989 08:46
Date: Sat, 07 Oct 1989 08:46
42 lines
1900 bytes
1900 bytes
The following code in dbxread.c can be falsely triggered by a zero-length array
in gcc:
/* g++ -g0 can put out bitpos & bitsize zero for a static
field. This does not give us any way of getting its
class, so we can't know its name. But we can just
ignore the field so we don't dump core and other nasty
stuff. */
if (list->field.bitpos == 0
&& list->field.bitsize == 0)
{
/* Have we given the warning yet? */
static int warning_given = 0;
/* Only give the warning once, no matter how many class
variables there are. */
if (!warning_given)
{
warning_given = 1;
fprintf_filtered (stderr, "\n\
Warning: DBX-style class variable debugging information encountered.\n\
You seem to have compiled your program with \
\"g++ -g0\" instead of \"g++ -g\".\n\
Therefore GDB will not know about your class variables.\n\
");
E.g. the declaration
typedef union {
int num;
char str[0];
} foo;
will generate a type stab: "foo:t16=u4num:1,0,32;str:17=ar1,0,-1;2,0,0;;"
I.e. str is an array of characters whose index ranges from 0 to -1 of type int,
but is at offset 0 and of length 0. Not certain how to recognize this
case as I'm not certain what in g++ can trigger a similar symbol entry.
An obvious point is that the field is an array yet has 0 bits allocated: a sure
sign that you've got a zero-length array...but would that conflict with the
thing that g++ produces? There's the question...
a
Technical Details
Message-ID:
<8910070846.AA02765@neon.bsw.com.>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!bsw!adamShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!bsw!adam From: bsw!adam@UUNET.UU.NET (Adam de Boor) Newsgroups: gnu.gdb.bug Subject: spurious warning in dbxread.c Message-ID: <8910070846.AA02765@neon.bsw.com.> Date: 7 Oct 89 08:46:02 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 42