From: Andrew Cagney <ac131313@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: Mark Kettenis <kettenis@chello.nl>,
mludvig@suse.cz, gdb-patches@sources.redhat.com
Subject: Re: [offbyone RFC] Merge i386newframe
Date: Fri, 14 Mar 2003 18:20:00 -0000 [thread overview]
Message-ID: <3E721D7E.7040906@redhat.com> (raw)
In-Reply-To: <3E71F9B4.5000504@redhat.com>
> Hmm. I was under the impression that we have this function because on
> some targets (the i386 is one of them) the frame hasn't been setup yet
> when we've stopped on the first instruction of a function.
>
> With CFI, frame or no frame, it is always possible to unwind the PC. A more complex prologue analysier could also manage to unwind the PC correctly in this case (but at the expense of doing prologue analysis).
>
> The function is called when doing a next and has just stepped into a function. To make the next faster (no prologue analysis), and the prologue analyzer easier (avoid most common frameless case).
>
> Thing is, it doesn't do anything for:
>
> (gdb) stepi
> Stepped into function foo()
> 0x10000 add 8 to sp
> (gdb) stepi
> 0x10000 store link-register in [sp + 4]
>
> which prologue analyzers should handle but don't `because it is to hard'. A simple minded suggestion is to limit the prologue analyser to the instruction range [func ... current-pc) so that, when still in the prologue, it only records what really happened.
>
> Perhaphs it should be superseeded by a method that takes a regcache instead of a frame (making the non-analysis of the prologue clearer)?
>
> I think that would be a good idea.
>
> Optional. It should fall back to using standard unwind_pc().
Hmm, why not get dogmatic? The prologue analyzer shall efficiently, and
correctly, handle the case of a pc in the prologue.
If that is a given, the pc == function edge case can be handled with:
if (pc == function)
// don't bother with prologue analysis
// all registers (except PC/LR) come from next frame
return;
or
for (iaddr = function; iaddr < pc; iaddr += insn length)
... examine instruction ...
either way it will efficiently avoid doing prologue analysis when on the
first instruction, and in the second case will result in a better analyzer.
Andrew
next prev parent reply other threads:[~2003-03-14 18:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-12 22:06 Michal Ludvig
2003-03-12 22:42 ` Daniel Jacobowitz
2003-03-13 19:05 ` Andrew Cagney
2003-03-13 22:46 ` Mark Kettenis
2003-03-14 15:48 ` Andrew Cagney
2003-03-14 16:19 ` Andrew Cagney
2003-03-14 18:20 ` Andrew Cagney [this message]
2003-04-06 17:10 ` Andrew Cagney
2003-04-07 18:53 ` Mark Kettenis
2003-03-14 11:54 ` Michal Ludvig
2003-03-14 15:59 ` Andrew Cagney
2003-03-14 15:43 ` Michal Ludvig
2003-03-16 12:48 ` Mark Kettenis
2003-03-17 7:52 ` Michal Ludvig
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=3E721D7E.7040906@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@chello.nl \
--cc=mludvig@suse.cz \
/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