This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: MIPS stack frame


On Mon, Apr 10, 2006 at 09:54:19AM +0530, Bharath Yadav wrote:
> I am working on retrieving the call stack information on MIPS
> platform. Does glibc support backtrace on MIPS either through
> backtrace() APIs or any other mechanism ? In i386, glibc has a set of
> 3 backtrace APIs which use the gcc builtins, __builtin_return_address
> and __builtin_frame_address to retrieve the stack frame information.
> However there seems to be no such implementation available for MIPs.
> Is it true ?  Please correct me if I am wrong.
> On MIPS though, I am able to get the current function s return address
> using the gcc builtin, __builtin_return_address. I also have the
> current function s frame pointer. My doubt is how do I traverse back
> to get the information about previous frame and the subsequent ones..?

You can't reliably.  MIPS code does not always use a frame pointer, and
without one the stack frame is not predictable.  That's why
__builtin_return_address doesn't work for >0.

Some architectures use .eh_frame if it is available to do backtraces.
I don't know why glibc doesn't do that by default for all
architectures.  If it did, you could use -fasynchronous-unwind-tables
to generate code that glibc could backtrace through.  Otherwise, your
best bet is to invoke an external GDB.

-- 
Daniel Jacobowitz
CodeSourcery


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