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]

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


Hi All,

On Solaris platform, when using dbx (or pstack) on a core file (w/o
access to symbol info) I get back the stack trace of function calls
with their argument addresses. On the other hand, when using gdb on
the same core file, the only thing shown is the function name,
followed by () - again, no symbols avail.

Example:
dbx: [1] strlen(0x0, 0x0, 0x5, 0x7efefeff, 0x81010100, 0xffbee178), at
0xff1332ec
gdb: #0 0xff1332ec in strlen () from /usr/lib/libc.so.1

Question 1: is it possible to achieve the same thing with gdb (ability
to see function argument addresses)? If not, is there another utility
that can be used?

We're planning to move to the Linux platform... I've been trying to
figure out a Linux equivalent for Solaris version of pstack to produce
stack traces for a core file, but so far I haven't been able to find
ANYTHING except for gdb. Linux version of pstack only works on a
running process. I compiled "lsstack", but that also only operated
only on a process (contrary to what several sources say).

Full stack trace for both dbx and gdb:

(/opt/SUNWspro/bin/../WS6U2
/bin/sparcv9/dbx) where
current thread: t@1
[1] strlen(0x0, 0x0, 0x5, 0x7efefeff, 0x81010100, 0xffbee178), at 0xff1332ec
[2] gethostbyname_r(0x0, 0x251d4, 0x251e8, 0x920, 0x251d4,
0xff31ef68), at 0xff2b61c8
[3] fm_ptd_pol_check_ldap(0x62678, 0x5fb50, 0x62740, 0xffbeee70, 0x0,
0xffbeee70), at 0xfd406ea0
[4] op_ptd_login_exist(0xfe7dd13c, 0x186e0, 0x0, 0x5fb50, 0x62740,
0xffbeee70), at 0xfd4054e8
[5] cm_custom(0xfe7dd13c, 0x22f58, 0x186e0, 0x0, 0x0, 0xffbef120), at 0xfe75285c
[6] cm_child(0x9, 0xfe000044, 0xfe7dd13c, 0xffbef534, 0x22f58,
0xfe000071), at 0xfe74f210
[7] main(0x1, 0xffbef734, 0xff1be5d8, 0xff11bc20, 0xff3b0000, 0x0), at
0xfe745210
=>[8] main(argc = 1, argv = 0xffbef734), line 33 in "cm.c"

(gdb) where
#0 0xff1332ec in strlen () from /usr/lib/libc.so.1
#1 0xff2b61d0 in gethostbyname_r () from /usr/lib/libnsl.so.1
#2 0xfd406ea8 in fm_ptd_pol_check_ldap () from
/global/opt/portal/6.2/pin4/lib/fm_ptd.so
#3 0xfd4054f0 in op_ptd_login_exist () from
/global/opt/portal/6.2/pin4/lib/fm_ptd.so
#4 0xfe752864 in cm_custom () from /global/opt/portal/6.2/pin4/lib/libcm_main.so
#5 0xfe74f218 in cm_child () from /global/opt/portal/6.2/pin4/lib/libcm_main.so
#6 0xfe745218 in main () from /global/opt/portal/6.2/pin4/lib/libcm_main.so
#7 0x10cb0 in main (argc=1, argv=0xffbef734) at
/pinbuild/cc_builds/6.2_SP4_idc_0912.1300/solaris/legacy_vob/continuus/All_Server~continuus/All_Server/cm:33

My other goal is to (manually, through code) extract a stack trace of
function calls with function argument addresses from a core dump. The
way to do it, it seems, is to get NT_PRSTATUS structure from the
core's NOTES section, and find the stack using ESP register contents.
But then... I am not sure what to do.

Question 2: How can I get a list of function calls with their
arguments off the stack?

Thank you in advance for any ideas / suggestions.
-Pavel


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