Argument pointers, dwarf and prologue analysis

Randolph Chung randolph@tausq.org
Tue Nov 22 00:07:00 GMT 2005


> How about full assembly and debug info for some case we get wrong?  At
> least three frames where the middle one uses its arguments after the
> call site, so we have a non-leaf function to look at.

ok, here we go:
tausq@hiauly3:~$ cat dwarfbug.c
void foo(int a, int b, int c, int d, int e)
{
   a = a;
}

void bar(int a, int b, int c)
{
   b = b;
   foo(5, 6, 7, 8, 9);
   a = a;
}

int main(int argc, char **argv)
{
   bar(1,2,3);
   return 0;
}
tausq@hiauly3:~$ gcc -g -o dwarfbug dwarfbug.c

tausq@hiauly3:~$ src/build64/gdb/gdb ./dwarfbug
GNU gdb 6.3.50.20051115-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "hppa64-hp-hpux11.11"...
(gdb) b foo
Breakpoint 1 at 0x4000000000002418: file dwarfbug.c, line 4.
(gdb) run
Starting program: /home/tausq/dwarfbug

Breakpoint 1, foo (a=5, b=6, c=7, d=8, e=9) at dwarfbug.c:4
4       }
(gdb) bt
#0  foo (a=5, b=6, c=7, d=8, e=9) at dwarfbug.c:4
#1  0x4000000000002474 in bar (a=5, b=6, c=7) at dwarfbug.c:9
#2  0x40000000000024d0 in main (argc=5, argv=0x6) at dwarfbug.c:15
(gdb) quit
The program is running.  Exit anyway? (y or n) y

Assembly  and readelf -wi output attached.

randolph
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dwarfbug.s
URL: <http://sourceware.org/pipermail/gdb/attachments/20051122/0e406706/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dwarfbug.txt
URL: <http://sourceware.org/pipermail/gdb/attachments/20051122/0e406706/attachment.txt>


More information about the Gdb mailing list