Article View: gnu.gcc.bug
Article #5915gcc/solaris and -g local symbols
From: Shankar Unni
Date: Tue, 28 Jan 1997 00:00
Date: Tue, 28 Jan 1997 00:00
59 lines
2512 bytes
2512 bytes
We use gcc 2.7.2 configured to use the Sun assembler (solaris 2.5.1),
and gdb 4.16, and found this ugly bug with local symbols declared in
inner blocks (i.e. not at the outermost block of the function).
For instance, for the source file
int y = 10;
main()
{
int x = y;
if (x > 0) {
int z = x; /* <<< */
return z;
}
}
When stopped at the line marked "<<<", gdb is unable to see the symbol
"z".
A "maint print syms /dev/tty" shows:
Blockvector:
block #000 (object 0x165b28) [0x10698..0x106d4]
int y; static at 0x20874,
int main(); block (object 0x165a90) starting at 0x10698,
block #001 (object 0x165ab8) [0x10698..0x106d4] (under 0x165b28)
[ ... builtin types ... ]
block #002 (object 0x165a90) [0x10698..0x106d4] (under 0x165ab8)
main
int x; local at offset 0xffffffec,
>>> block #003 (object 0x165a68) [0x106cc..0x106cc] (under 0x165a90)
int z; local at offset 0xffffffe8,
Notice how the offsets for block #003 are garbage (they point to a
single instruction at the end of the actual block). The same thing
happens in a for statement, for example, where the whole block range
gets collapsed to point to a single instruction in the for loop trailer.
I've checked the .stabs, and they seem correct, but I'm not very
familiar with stabs (from an almost identical .s file, the SunOS 4
assembler/gdb combo does the right thing).
Is this a known Solaris assembler bug? Is there a patch for it? What's
the recommended solution to this problem? Using gas?
Or is this a gdb problem?
One frustrating aspect of this is that I can't get the Sun "dump" tool
(nice name, Sunoids!) to print anything for "dump -D", so I can only see
hex stabs.
Many thanks,
--
Shankar Unni shankar@chromatic.com
Chromatic Research (408) 752-9488
Technical Details
Message-ID:
<32EE8DB5.665B@chromatic.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,c890b9ec6e45e6ad,start X-Google-Attributes: gid113d02,public From: shankar@chromatic.com (Shankar Unni) Subject: gcc/solaris and -g local symbols Date: 1997/01/28 Message-ID: <32EE8DB5.665B@chromatic.com> X-Deja-AN: 212862856 sender: shankar@chromatic.com content-type: text/plain; charset=us-ascii organization: Chromatic Research, Sunnyvale, CA x-gateway: relay1.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 28 Jan 1997 18:40:31 EST mime-version: 1.0 newsgroups: gnu.gcc.bug x-mailer: Mozilla 3.0Gold (X11; I; SunOS 5.5.1 sun4u)