Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: gdb-patches <gdb-patches@sourceware.org>
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>,
	green@moxielogic.com, 	Yao Qi <yao@codesourcery.com>
Subject: Re: [PATCH] Remove some obfuscation from ${arch}_skip_prologue functions
Date: Wed, 03 Sep 2014 17:19:00 -0000	[thread overview]
Message-ID: <CADPb22Tmxkj81MSghL8yn-TJm3onZK+-HHUt8fKM3ggY8UxNzQ@mail.gmail.com> (raw)
In-Reply-To: <yjt2y4u1pokj.fsf@ruffy.mtv.corp.google.com>

On Tue, Sep 2, 2014 at 4:53 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> This patch is a follow up to an observation made here:
> https://sourceware.org/ml/gdb-patches/2014-08/msg00539.html
>
> [...]
>
> At the very least, I'd like to document Why Things Are The Way They Are
> if there is indeed a reason for it.
>
> [...]

btw, there is still one aspect here that I don't understand the WHY of:

aarch64-tdep.c and others do this (grep for <<<<):

  /* See if we can determine the end of the prologue via the symbol
     table.  If so, then return either PC, or the PC after the
     prologue, whichever is greater.  */
  if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
    {
      CORE_ADDR post_prologue_pc
        = skip_prologue_using_sal (gdbarch, func_addr);

      if (post_prologue_pc != 0)
        return max (pc, post_prologue_pc); //<<<<
    }

Why?  Why max (pc, post_prologue_pc) ?

Is it because ${arch}_skip_prologue can be called
with a pc value greater than the start address of the function?
If so, when?
Are people just being conservative because it's not clear
what values of pc may be passed to ${arch}_skip_prologue?
[If so we've got unnecessarily complex code due to unclear APIs ... bleah.]

N.B. There are only two arches that I could find where
(I think) the pc passed to ${arch}_skip_prologue could
be different than the function's entry point:
1) vax, which sets deprecated_function_start_offset
2) ppc-linux (elf v2), which sets skip_entrypoint

If I'm missing something ... great ... let's get it documented.
[And if it is documented, let's make it easier to find. :-)
The prologue stuff I can find from the Internals Wiki doesn't
discuss this, and I wasn't about to read the entire wiki
looking for it.]


  reply	other threads:[~2014-09-03 17:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 23:53 Doug Evans
2014-09-03 17:19 ` Doug Evans [this message]
2014-09-04  8:59 ` Yao Qi
2014-09-04 17:42   ` Doug Evans
2014-09-09  1:29     ` Yao Qi
2014-09-04 17:51 ` Maciej W. Rozycki

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=CADPb22Tmxkj81MSghL8yn-TJm3onZK+-HHUt8fKM3ggY8UxNzQ@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=green@moxielogic.com \
    --cc=macro@codesourcery.com \
    --cc=yao@codesourcery.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