This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb / dbx / pstack question - getting function argument addresses from stack


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]