From: ligang@sunnorth.com.cn
To: Joel Brobecker <brobecker@adacore.com>
Cc: bjgnu@sunnorth.com.cn, gdb@sourceware.org
Subject: Re: fail to get ra and bp
Date: Thu, 12 Oct 2006 07:14:00 -0000 [thread overview]
Message-ID: <OFD6B56831.3737EE08-ON48257205.0027E6D7-48257205.0027E707@sunnorth.com.cn> (raw)
gdb-owner@sourceware.org wrote on 2006-10-12 13:39:44:
> > I am porting GDB to a new target.
>
> Would you mind telling us what this new target is? I believe this will
> greatly help us provide more accurate answers. In the meantime...
The new target is named Score ---- 32 bit core designed by Chinese IC
company.
Both GCC for Score and Binutils for Score have entered GNU main tree just
now.
In future, GDB for Score is willing to enter GNU official release.
> > The prologue has two insns ---- push ra and push bp.
> > When back tracing and printing variables, gdb will look for return
address
> > of this frame and frame pointer on stack.
> > Unfortunately, If compiling with -O2, the two insns are probably
deleted.
> > So, GDB will not get ra and bp value.
>
> Typical problem. My recommendation, stay away from prologue analysis
> as much as you can, because as you know, higher levels of optimization
> will break the typical frame layout. What you want, is have this
> information provided by the compiler itself and dumped into the
> objects in some form.
>
> One very popular form, at least in the GNU world, is DWARF CFI. There
> is also another popular form, which I don't really know much about.
> The information is stored in .eh_frame sections. But it essentially
> does the same: It tells you how to unwind the call stack.
Do you know which target use .eh_frame to handle call stack?
Would you please give me more info about .eh_frame or some documents
describing it?
> This is what you want because this information allows you to avoid
> tricky prologue scanning and hairy heuristics to try to guess where
> things are.
>
> Now that I think of it, if you have no choice but do prologue scanning,
> you might want to look at a framework that was recently contributed
> which should make your task easier. I think it's prologue-value.[hc].
Could I directly call the functions in prologue-value.[hc]?
> --
> Joel
next reply other threads:[~2006-10-12 7:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-12 7:14 ligang [this message]
2006-10-12 12:54 ` Daniel Jacobowitz
-- strict thread matches above, loose matches on Subject: below --
2006-10-12 5:21 ligang
2006-10-12 5:39 ` Joel Brobecker
2006-10-12 4:33 bjgnu
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=OFD6B56831.3737EE08-ON48257205.0027E6D7-48257205.0027E707@sunnorth.com.cn \
--to=ligang@sunnorth.com.cn \
--cc=bjgnu@sunnorth.com.cn \
--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