From: Yao Qi <yao@codesourcery.com>
To: Doug Evans <dje@google.com>
Cc: <gdb-patches@sourceware.org>, <macro@codesourcery.com>,
<green@moxielogic.com>
Subject: Re: [PATCH] Remove some obfuscation from ${arch}_skip_prologue functions
Date: Thu, 04 Sep 2014 08:59:00 -0000 [thread overview]
Message-ID: <87ha0ndaub.fsf@codesourcery.com> (raw)
In-Reply-To: <yjt2y4u1pokj.fsf@ruffy.mtv.corp.google.com> (Doug Evans's message of "Tue, 2 Sep 2014 16:53:00 -0700")
Doug Evans <dje@google.com> writes:
> 1) There's no need to call find_pc_partial_function before
> calling skip_prologue_using_sal: The first thing skip_prologue_using_sal
> does is call find_pc_partial_function!
Nowadays we have:
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);
}
so your statement is valid if PC equals to FUNC_ADDR. I don't have a
case that PC and FUNC_ADDR are different, but I'd like to add an assert
to check this, in each target's implementation of skip_prologue hook, or
in the callers of gdbarch_skip_prologue, something like:
if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
gdb_assert (pc == func_addr);
Note that this assert is triggered on arm in
gdb.cp/re-set-overloaded.exp, that is PC is [1] but FUNC_ADDR is [2].
(gdb) disassemble _ZN1CC1Ei
Dump of assembler code for function _ZN1CC1Ev:
0x0000090c <+0>: ldr r12, [pc, #4] ; 0x918 <_ZN1CC1Ev+12> <- [2]
0x00000910 <+4>: add r12, r12, pc
0x00000914 <+8>: bx r12
0x00000918 <+12>: ; <UNDEFINED> instruction: 0xffffffc5
0x0000091c <+0>: ldr r12, [pc, #4] ; 0x928 <_ZN1CC1Ei+12> <- [1]
0x00000920 <+4>: add r12, r12, pc
AFAICS, PC is still the function address but find_pc_partial_function
computes the FUNC_ADDR incorrectly and it is nothing wrong about your
patch.
> nios2: yao@codesourcery.com
I tested your patch on nios2-linux, and no regression is found.
> tic6x:yao@codesourcery.com
My c6x board is dead in data center, so I can't test this patch for it.
--
Yao (齐尧)
next prev parent reply other threads:[~2014-09-04 8:59 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
2014-09-04 8:59 ` Yao Qi [this message]
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=87ha0ndaub.fsf@codesourcery.com \
--to=yao@codesourcery.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=green@moxielogic.com \
--cc=macro@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