public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
@ 2024-03-06 10:52 vries at gcc dot gnu.org
  2024-03-06 13:06 ` [Bug tdep/31453] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-06 10:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

            Bug ID: 31453
           Summary: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp:
                    disassemble thumb instruction (1st try)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On arm-linux, I ran into:
...
(gdb) x /i main+8^M
   0x4e1 <main+7>:      vrhadd.u16      d14, d14, d31^M
(gdb) FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
...

Likewise, this fails:
...
$ gdb -q -batch outputs/gdb.arch/pr25124/pr25124 -ex "disassemble main"
Dump of assembler code for function main:
   0x000004d9 <-1>:     bx      pc
   0x000004db <+1>:     nop
   0x000004dd <+3>:     movs    r0, r0
   0x000004df <+5>:     b.n     0xc22
   0x000004e1 <+7>:     vrhadd.u16      d14, d14, d31
End of assembler dump.
...

This is a regression due to PR gas/31115 (reported on 2.39, found this with
2.40, presumably also present in 2.41, and still unfixed), which makes gas
produce a low_pc with the thumb bit set:
...
 <1><24>: Abbrev Number: 2 (DW_TAG_subprogram)
    <25>   DW_AT_name        : (indirect string, offset: 0x65): main
    <29>   DW_AT_external    : 1
    <29>   DW_AT_type        : <0x2f>
    <2a>   DW_AT_low_pc      : 0x4d9
    <2e>   DW_AT_high_pc     : 12
 <1><2f>: Abbrev Number: 3 (DW_TAG_unspecified_type)
...

With this workaround in gdb:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 486be7e4921..b4c8c41f5f8 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9974,6 +9974,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu
*cu)
   lowpc = per_objfile->relocate (unrel_low);
   highpc = per_objfile->relocate (unrel_high);

+  lowpc = gdbarch_addr_bits_remove (gdbarch, lowpc);
+  highpc = gdbarch_addr_bits_remove (gdbarch, highpc);
+
   /* If we have any template arguments, then we must allocate a
      different sort of symbol.  */
   for (child_die = die->child; child_die; child_die = child_die->sibling)
...
the test-case passes, and the disassembly command produces sane output:
...
$ gdb -q -batch outputs/gdb.arch/pr25124/pr25124 -ex "disassemble main"
Dump of assembler code for function main:
   0x000004d8 <+0>:     bx      pc
   0x000004da <+2>:     nop
   0x000004dc <+4>:     mov     r0, #0
   0x000004e0 <+8>:     bx      lr
End of assembler dump.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31453] [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
  2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
@ 2024-03-06 13:06 ` vries at gcc dot gnu.org
  2024-03-06 15:53 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-06 13:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15386
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15386&action=edit
Tentative patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31453] [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
  2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
  2024-03-06 13:06 ` [Bug tdep/31453] " vries at gcc dot gnu.org
@ 2024-03-06 15:53 ` vries at gcc dot gnu.org
  2024-03-06 15:55 ` sam at gentoo dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-06 15:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2024-March/207084.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31453] [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
  2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
  2024-03-06 13:06 ` [Bug tdep/31453] " vries at gcc dot gnu.org
  2024-03-06 15:53 ` vries at gcc dot gnu.org
@ 2024-03-06 15:55 ` sam at gentoo dot org
  2024-03-20  8:56 ` cvs-commit at gcc dot gnu.org
  2024-03-20  8:57 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2024-03-06 15:55 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=31115
                 CC|                            |sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31453] [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
  2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-06 15:55 ` sam at gentoo dot org
@ 2024-03-20  8:56 ` cvs-commit at gcc dot gnu.org
  2024-03-20  8:57 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-20  8:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a61ee551ce3059f602fee1e576af08c03f991bc

commit 8a61ee551ce3059f602fee1e576af08c03f991bc
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Mar 20 09:57:49 2024 +0100

    [gdb/symtab] Workaround PR gas/31115

    On arm-linux, with gas 2.40, I run into:
    ...
    (gdb) x /i main+8^M
       0x4e1 <main+7>:      vrhadd.u16      d14, d14, d31^M
    (gdb) FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
    ...

    This is a regression due to PR gas/31115, which makes gas produce a low_pc
    with the thumb bit set (0x4d8 & 0x1):
    ...
     <1><24>: Abbrev Number: 2 (DW_TAG_subprogram)
        <25>   DW_AT_name        : main
        <29>   DW_AT_external    : 1
        <29>   DW_AT_type        : <0x2f>
        <2a>   DW_AT_low_pc      : 0x4d9
        <2e>   DW_AT_high_pc     : 12
    ...

    The regression was introduced in 2.39, and is also present in 2.40 and
2.41,
    and hasn't been fixed yet.

    Work around this in read_func_scope, by using gdbarch_addr_bits_remove on
    low_pc and high_pc.

    Tested on arm-linux and x86_64-linux.

    PR tdep/31453
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31453

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tdep/31453] [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try)
  2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-20  8:56 ` cvs-commit at gcc dot gnu.org
@ 2024-03-20  8:57 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-20  8:57 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31453

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |15.1

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-20  8:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06 10:52 [Bug tdep/31453] New: [gdb/tdep, arm] FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) vries at gcc dot gnu.org
2024-03-06 13:06 ` [Bug tdep/31453] " vries at gcc dot gnu.org
2024-03-06 15:53 ` vries at gcc dot gnu.org
2024-03-06 15:55 ` sam at gentoo dot org
2024-03-20  8:56 ` cvs-commit at gcc dot gnu.org
2024-03-20  8:57 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).