Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: davidm@hpl.hp.com, gdb@sources.redhat.com
Subject: Re: question on gdbarch_skip_prologue()
Date: Thu, 07 Mar 2002 10:13:00 -0000	[thread overview]
Message-ID: <15495.44458.890110.519531@napali.hpl.hp.com> (raw)
In-Reply-To: <1020307081116.ZM26473@localhost.localdomain>

>>>>> On Thu, 7 Mar 2002 01:11:17 -0700, Kevin Buettner <kevinb@redhat.com> said:

  Kevin> GDB currently expects that the skip_prologue() function will
  Kevin> return a PC that's after the last prologue instruction that
  Kevin> saved an argument to its "home" location (if any) in memory
  Kevin> (or whereever the debug info says that a parameter's location
  Kevin> is).  The difficulty with this, of course, is that with
  Kevin> optimized code, it can be very difficult to discern where
  Kevin> this is.

So, if I may paraphrase, skip_prologue() returns the PC of the first
instruction for which the debug info will be valid, right?

If so, I'd argue this has much more to do with debug info than with
unwind info.  For example, hand-written assembly routines often have
sizable prologues, but a programmer would almost certainly want a
breakpoint to be placed right at the beginning of the function, not at
the end of the prologue.

Now, I wonder whether it wouldn't be possible and indeed better to
implement skip_prologue() based on debug info.  Unfortunately, I'm not
very familiar with, say, DWARF2.  However, I did notice that applying
the "info line" command to the first line of source code in a C
program does indeed return a starting address that corresponds to the
value that ought to be returned by skip_prologue().

Perhaps skip_prologue() could look for the first PC that is covered by
line info and return that value (or the original PC if there is no
such PC)?  To be on the safe side, skip_prologue() probably ought to
give up the search as soon as it sees a branch instruction.

Would this be a safe algorithm?

	--david


  reply	other threads:[~2002-03-07 18:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-06 22:28 David Mosberger
     [not found] ` <davidm@napali.hpl.hp.com>
2002-03-07  0:12   ` Kevin Buettner
2002-03-07 10:13     ` David Mosberger [this message]
2002-03-07 10:42   ` Kevin Buettner
2002-03-07 11:55     ` David Mosberger

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=15495.44458.890110.519531@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=davidm@hpl.hp.com \
    --cc=gdb@sources.redhat.com \
    --cc=kevinb@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