Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Pavel Chernikov <pchernik@gmail.com>
Cc: Michael Snyder <msnyder@specifix.com>,
		Joel Brobecker <brobecker@adacore.com>,
	gdb@sourceware.org
Subject: Re: gdb / dbx / pstack question - getting function argument 	addresses from stack
Date: Thu, 26 Jun 2008 19:04:00 -0000	[thread overview]
Message-ID: <20080626190421.GA31664@caradoc.them.org> (raw)
In-Reply-To: <7611a2ff0806261156x3b6dd54cv880129c0be194e06@mail.gmail.com>

On Thu, Jun 26, 2008 at 02:56:45PM -0400, Pavel Chernikov wrote:
> Right, understood - thanks for pointing that out to me. I should have
> mentioned that the original platform was SPARC Solaris and the new
> platform is I386 Linux.
> 
> With that said, am I absolutely-totally-100% out of luck with being
> able to find function argument addresses? Or is there some way of
> doing this?
> 
> Ideally, I'd like to write the following solution in C:
> * List all function calls with corresponding function argument list
> for each function

Basically, you can not do this in any reliable way without debug info.
You might be able to approximate of it by studying the x86 ABI, since
GDB does expose the stack pointer at the time of call; in normal cases
(not always), arguments will be consecutive words starting at $esp in
the caller.

A more useful approach might be a GCC mode which generates reduced
debug info, including parameters but little else.  I don't remember if
that's what -g1 does.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-06-26 19:04 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
2008-06-26 18:47         ` Michael Snyder
2008-06-26 18:57           ` Pavel Chernikov
2008-06-26 19:04             ` Daniel Jacobowitz [this message]
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=20080626190421.GA31664@caradoc.them.org \
    --to=drow@false.org \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=msnyder@specifix.com \
    --cc=pchernik@gmail.com \
    /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