This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
problem with debugging local scoped symbols on MIPS
- From: Don Bowman <don at sandvine dot com>
- To: "'gdb at sources dot redhat dot com'" <gdb at sources dot redhat dot com>
- Date: Thu, 31 Jan 2002 17:17:10 -0500
- Subject: problem with debugging local scoped symbols on MIPS
I'm not sure if this is a problem with GDB or GCC or GAS,
so any help would be appreciated.
I take a very simple file:
extern "C" void printf(const char *, ...);
extern "C" void testFunc()
{
int i;
i = 1;
for (int j = 0; j < 2; j++)
{
i+= j;
printf("%d %d\n", i, j);
}
}
and compile it with gcc 3.0.3 and gas 2.11.2 for MIPS (mips-wrs-vxworks).
This is a little-endian ELF mips platform. I'm cross-compiling
from cygwin (but I don't think that matters).
Now, in gdb, the 'i' variable is all good, but 'j' doesn't
exist as far as gdb knows. info locals just shows 'i',
regardless of which line I'm on. Now, from the shell of
gdb, if I do 'p j', I get something like "$1 = 106". Next
time I run it I get "$2 = 106". I don't know what this means.
gdb is configured for mips-wrs-vxworks (again cross from cygwin).
The .stab stuff is below. I removed all the assembly and other
things. I see that "j" is noticed, 5 lines from the bottom.
But gdb seems to have no knowledge. Any suggestions on where
I should look? I've tried -ggdb, -gstabs, -gstabs+, -gcoff, but
I get the same affect.
.stabs "/m/don_view/fw/vw/config/ps2xxx/ps2100b/",100,0,0,$Ltext0
.stabs "test.cc",100,0,0,$Ltext0
.stabn 68,0,3,$LM1
.stabs "test.cc",132,0,0,$Ltext0
.stabn 68,0,5,$LM2
.stabn 68,0,6,$LM3
.stabn 68,0,8,$LM4
.stabn 68,0,9,$LM5
.stabn 68,0,6,$LM6
.stabn 68,0,11,$LM7
.stabs "testFunc:F21",36,0,3,testFunc
.stabs "i:1",128,0,4,-24
.stabn 192,0,0,$LBB2
.stabs "j:1",128,0,6,-20
.stabn 192,0,0,$LBB3
.stabn 224,0,0,$LBE3
.stabn 224,0,0,$LBE2
.stabs "",36,0,0,$Lscope0-testFunc