Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Pavel Chernikov" <pchernik@gmail.com>
To: "Joel Brobecker" <brobecker@adacore.com>
Cc: gdb@sourceware.org
Subject: Re: gdb / dbx / pstack question - getting function argument addresses from stack
Date: Thu, 26 Jun 2008 18:09:00 -0000	[thread overview]
Message-ID: <7611a2ff0806261108o1855655cp7705418469e8bdf5@mail.gmail.com> (raw)
In-Reply-To: <20080626162449.GF3595@adacore.com>

>    (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


  reply	other threads:[~2008-06-26 18:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 13:20 Pavel Chernikov
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 [this message]
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=7611a2ff0806261108o1855655cp7705418469e8bdf5@mail.gmail.com \
    --to=pchernik@gmail.com \
    --cc=brobecker@adacore.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