Thread View: gnu.gdb.bug
1 messages
1 total messages
Started by Johan Widen
Fri, 24 Mar 1989 20:41
gdb and cc disagree about register variables, on the Sequent Symmetry
Author: Johan Widen
Date: Fri, 24 Mar 1989 20:41
Date: Fri, 24 Mar 1989 20:41
63 lines
1882 bytes
1882 bytes
Operating syetem: DYNIX V3.0.12
If I compile the following code with
cc -g -S
int times3plus6(i)
int i;
{
register int j = i+1;
register int k = i+2;
register int l = i+3;
return j+k+l;
}
and then run this under gdb, gdb will find the variables
i, j, k
but return a bad value for
l
If we inspect the generated assembler code we find something like:
.stabd 0104,0,06
.stabs "j:r1",0x40,0,4,7
movl 8(%ebp),%eax
incl %eax
movl %eax,%edi
.stabd 0104,0,07
.stabs "k:r1",0x40,0,4,6
movl 8(%ebp),%eax
leal 2(%eax),%eax
movl %eax,%esi
.stabd 0104,0,010
.stabs "l:r1",0x40,0,4,5 <--- This is the problem
movl 8(%ebp),%eax
leal 3(%eax),%eax
movl %eax,%ebx
.stabd 0104,0,011
.stabd 0104,0,012
.stabd 0300,0,02
movl %edi,%eax
addl %esi,%eax
addl %ebx,%eax
the line I have marked as the trouble spot, says that the variable l
is stored in register
ebp
At least that is what I and gdb believe. I believe that the correct
line should be
.stabs "l:r1",0x40,0,4,3
to indicate that 'l' is stored in
ebx
Am I off the track here? Is cc actually correct? dbx will apparently
interpret the generated stabs as "l is in ebx".
gcc will generate
.stabs "l:r1",64,0,0,3
to indicate that "l is in ebx".
--
Johan Widen
SICS, PO Box 1263, S-164 28 KISTA, SWEDEN Internet: jw@sics.se
Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads