From: Andrew Cagney <cagney@gnu.org>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sources.redhat.com
Subject: Re: get_frame_func() VS get_frame_id().code
Date: Tue, 09 Mar 2004 02:54:00 -0000 [thread overview]
Message-ID: <404D31D9.6050203@gnu.org> (raw)
In-Reply-To: <20040307000139.GA10524@nevyn.them.org>
> On Fri, Mar 05, 2004 at 11:05:54AM -0500, Andrew Cagney wrote:
>
>>> Hello,
>>>
>>> The current get_frame_func() is implemented as roughly:
>>>
>>> fi->prev_func.addr = get_pc_function_start (addr_in_block);
>>>
>>> Unfortunatly this isn't valid for a signal trampoline (or at least the
>>> evil ones that consist of random bytes in a random memory location).
>>> For such trampolines, get_pc_function_start [rightly] fails and "func"
>>> ends up as zero -- not good -- a properly constructed frame ID requires
>>> non-zero code and stack addresses.
>>>
>>> Fortunatly, with a bit of extra instruction pattern matching, it is
>>> possible to identify the first instruction of a signal trampoline and
>>> hence correctly compute the trampolines "func" address. Similarly, more
>>> normal frames can determine the function start using the symbol table's
>>> get_pc_function_start.
>>>
>>> Consequently, I think there should be mechanism for obtaining both the
>>> symbol table and frame's idea of a function's start address. This would
>>> mean introducing:
>>>
>>> - get_frame_func_by_symtab
>>> Returns the function start according to the symbol table. Much of the
>>> existing code (especially unwinders) would need to be updated to use this.
>
>
> How about just leaving this as frame_func_unwind?
Because the func, based on the frame ID, is more likely to be correct.
The current get_frame_func and frame_func_unwind can return 0 or the
wrong function :-(
BTW, there is get_frame_function() which returns the symbol for the
function.
> The only current use
> of frame_func_unwind that I see outside of unwinders is the
> implementation of get_frame_func.
... get_frame_func is hardly called ...
> So we could define frame_func_unwind
> to attempt to find the beginning of the function at the unwound PC
> using the symtab.
... so it may even be possible to simply pull get_frame_func from the
frame interface.
> It is already the unwinder's duty to propogate the function address
> into the ID.
Andrew
prev parent reply other threads:[~2004-03-09 2:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-05 16:06 Andrew Cagney
2004-03-07 0:01 ` Daniel Jacobowitz
2004-03-09 2:54 ` Andrew Cagney [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=404D31D9.6050203@gnu.org \
--to=cagney@gnu.org \
--cc=drow@false.org \
--cc=gdb@sources.redhat.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