Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@specifix.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Pavel Chernikov <pchernik@gmail.com>, gdb@sourceware.org
Subject: Re: gdb / dbx / pstack question - getting function argument 	addresses from stack
Date: Thu, 26 Jun 2008 19:07:00 -0000	[thread overview]
Message-ID: <1214507238.3601.1383.camel@localhost.localdomain> (raw)
In-Reply-To: <20080626185008.GC8971@adacore.com>

On Thu, 2008-06-26 at 14:50 -0400, Joel Brobecker wrote:
> > As you've mentioned previously, this only works on Solaris. Am I
> > totally out of luck on Linux?
> 
> The Operating System is actually not the most important factor in
> this case. The reason why this "works" on Sparc is because the Sparc
> ABI says that the first few parameters should be passed through the
> output/input registers. There can be up to 6 registers passed this
> way.  So when dbx prints the "parameters" when there is no debugging
> info, it is actually printing the contents of these registers.
> 
> You didn't say which CPU your Linux was running on, but I'll guess
> it's x86. I don't know x86 all that well, but I remember that the
> arguments are passed through the stack at an offset to the function
> frame base. So the idea that works on Sparc doesn't work for x86,
> and I don't see another simple scheme that would work on x86 either.

Worse, they're sometimes passed on the stack, and 
sometimes in registers, and sometimes both.  Only
the compiler knows for sure (in the absence of 
debug info).




      parent reply	other threads:[~2008-06-26 19:07 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
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 [this message]

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=1214507238.3601.1383.camel@localhost.localdomain \
    --to=msnyder@specifix.com \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --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