This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb / dbx / pstack question - getting function argument addresses from stack


>    (gdb) print /x $i0
>    $1 = 0xfeedface

As you've mentioned previously, this only works on Solaris. Am I
totally out of luck on Linux?

pchernik@ptxubuntu:~/cor$ cat foo.c
#include <string.h>

void bar(char *p1, char *p2) {
       char *p3;
       strcpy(p3, "fail");
}

int main() {
       char *p1 = "test1";
       char *p2 = "test1";
       bar(p1, p2);
}
pchernik@ptxubuntu:~/cor$ gcc -o foo foo.c
pchernik@ptxubuntu:~/cor$ foo
Segmentation fault (core dumped)
pchernik@ptxubuntu:~/cor$ gdb foo core
GNU gdb 6.6-debian
Copyright (C) 2006 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 "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `foo'.
Program terminated with signal 11, Segmentation fault.
#0  0x0804834d in bar ()
(gdb) where
#0  0x0804834d in bar ()
#1  0x0804838a in main ()
(gdb) print $i0
$1 = void
(gdb) q

Thanks,
-Pavel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]