From: Doug Evans <dje@google.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix gdb.dwarf2/dwz.exp for thumb mode
Date: Wed, 03 Sep 2014 17:51:00 -0000 [thread overview]
Message-ID: <CADPb22QyvC5tCZNiYxXSY=J5k3C8dDmH_5n9d9rm2ybu-Eg7Xw@mail.gmail.com> (raw)
In-Reply-To: <1409706936-11220-1-git-send-email-yao@codesourcery.com>
On Tue, Sep 2, 2014 at 6:15 PM, Yao Qi <yao@codesourcery.com> wrote:
> Hi,
> We see the fail in gdb.dwarf2/dwz.exp in thumb mode,
>
> p the_int^M
> $2 = 99^M
> (gdb) FAIL: gdb.dwarf2/dwz.exp: p the_int
>
> In thumb mode, the lsb of references to 'main' in the assembly
> (produced by dwarf assember) is set, so the generated debug
> information is incorrect.
>
> This patch copies the approach from
>
> [PATCH 4/4] Fix gdb.trace/entry-values.exp for thumb mode
> https://sourceware.org/ml/gdb-patches/2014-07/msg00041.html
>
> introduce new label 'main_start' which is the correct
> function address (without lsb set). This patch fixes these
> fails we've seen.
>
> Regression tested on arm-none-eabi and x86_64-linux.
>
> gdb/testsuite:
>
> 2014-09-03 Yao Qi <yao@codesourcery.com>
>
> * gdb.dwarf2/dwz.exp: Use main_start instead of main.
> * gdb.dwarf2/main.c: Define label 'main_start' at the beginning
> function 'main'.
> ---
> gdb/testsuite/gdb.dwarf2/dwz.exp | 4 ++--
> gdb/testsuite/gdb.dwarf2/main.c | 4 ++++
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp
> index 9175f9e..ef19631 100644
> --- a/gdb/testsuite/gdb.dwarf2/dwz.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dwz.exp
> @@ -79,8 +79,8 @@ Dwarf::assemble $asm_file {
> partial_label: partial_unit {} {
> subprogram {
> {name main}
> - {low_pc main addr}
> - {high_pc "main + $main_length" addr}
> + {low_pc main_start addr}
> + {high_pc "main_start + $main_length" addr}
> }
> }
> }
> diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c
> index 3ddd194..5a4cbc3 100644
> --- a/gdb/testsuite/gdb.dwarf2/main.c
> +++ b/gdb/testsuite/gdb.dwarf2/main.c
> @@ -17,6 +17,10 @@
>
> /* Dummy main function. */
>
> +asm (".section \".text\"");
> +asm (".balign 8");
> +asm ("main_start: .globl main_start");
> +
> int
> main()
> {
This approach is fragile w.r.t. clang.
IIUC, Clang makes no guarantees about the ordering of global asms and
other objects, or even other objects w.r.t. each other (even at -O0).
The email you refer to above refers to another email,
https://sourceware.org/ml/gdb-patches/2014-03/msg00202.html
and that email does a similar thing to fix dw2-ifort-parameter.exp
(not for thumb, but for similar reasons).
dw2-ifort-parameter.exp currently fails with clang on amd64-linux because
func gets moved after main, but the asms that wrap func stay put.
Loosely speaking,
asm ("func_start:");
void func () {}
asm ("func_end:");
int main () { return 0; }
gets emitted as:
asm ("func_start:");
asm ("func_end:");
int main () { return 0; }
void func () {}
I don't have a solution yet, I'm just giving a "heads up".
next prev parent reply other threads:[~2014-09-03 17:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 1:23 Yao Qi
2014-09-03 17:51 ` Doug Evans [this message]
2014-09-05 11:08 ` Yao Qi
2014-09-14 9:35 ` Yao Qi
2014-09-15 12:29 ` Yao Qi
2014-09-22 13:52 ` Yao Qi
2014-09-30 14:04 ` Yao Qi
2014-10-07 14:03 ` Yao Qi
2014-09-14 11:31 Andreas Schwab
2014-09-14 14:37 ` Yao Qi
2014-09-14 15:24 ` Andreas Schwab
2014-09-15 2:09 ` Yao Qi
2014-09-15 8:57 ` Andreas Schwab
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='CADPb22QyvC5tCZNiYxXSY=J5k3C8dDmH_5n9d9rm2ybu-Eg7Xw@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--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