Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Pavel Chernikov" <pchernik@gmail.com>
To: gdb@sourceware.org
Subject: gdb / dbx / pstack question - getting function argument addresses from stack
Date: Thu, 26 Jun 2008 13:20:00 -0000	[thread overview]
Message-ID: <7611a2ff0806260620k4e4f6765l6a306c7e363fa12e@mail.gmail.com> (raw)

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


             reply	other threads:[~2008-06-26 13:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 13:20 Pavel Chernikov [this message]
2008-06-26 14:26 ` Joel Brobecker
2008-06-26 15:03   ` Pavel Chernikov
2008-06-26 16:25     ` Joel Brobecker
2008-06-26 18:09       ` Pavel Chernikov
2008-06-26 18:47         ` Michael Snyder
2008-06-26 18:57           ` Pavel Chernikov
2008-06-26 19:04             ` Daniel Jacobowitz
2008-06-26 19:06             ` Joel Brobecker
2008-06-26 19:11             ` Michael Snyder
2008-06-26 18:50         ` Joel Brobecker
2008-06-26 19:01           ` Pavel Chernikov
2008-06-26 19:07           ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7611a2ff0806260620k4e4f6765l6a306c7e363fa12e@mail.gmail.com \
    --to=pchernik@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox