From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13174 invoked by alias); 26 Jun 2008 13:20:48 -0000 Received: (qmail 13165 invoked by uid 22791); 26 Jun 2008 13:20:47 -0000 X-Spam-Check-By: sourceware.org Received: from rn-out-0910.google.com (HELO rn-out-0910.google.com) (64.233.170.185) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jun 2008 13:20:30 +0000 Received: by rn-out-0910.google.com with SMTP id k40so38853rnd.0 for ; Thu, 26 Jun 2008 06:20:27 -0700 (PDT) Received: by 10.151.150.13 with SMTP id c13mr67463ybo.217.1214486427489; Thu, 26 Jun 2008 06:20:27 -0700 (PDT) Received: by 10.150.52.19 with HTTP; Thu, 26 Jun 2008 06:20:27 -0700 (PDT) Message-ID: <7611a2ff0806260620k4e4f6765l6a306c7e363fa12e@mail.gmail.com> Date: Thu, 26 Jun 2008 13:20:00 -0000 From: "Pavel Chernikov" To: gdb@sourceware.org Subject: gdb / dbx / pstack question - getting function argument addresses from stack MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00273.txt.bz2 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