public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29943] New: Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S
@ 2022-12-26 20:14 pauldfaria at gmail dot com
  2022-12-28 10:40 ` [Bug gdb/29943] " vries at gcc dot gnu.org
  2023-01-05 13:18 ` vries at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pauldfaria at gmail dot com @ 2022-12-26 20:14 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29943
           Summary: Gdb assertion failure on `layout reg general` for
                    armv6-m source compiled from .S
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: pauldfaria at gmail dot com
  Target Milestone: ---

Gdb assertion triggered when trying to view registers in tui mode for arm
assembly program compiled from .S file. The assembly is intended for
cortex-m0plus, thumb format.

To repro:
1. Use file hello-world.S:
```
.syntax unified
.thumb

.text
.global _start

.thumb_func
_start:
  bkpt
```
2. run `arm-none-eabi-gcc -E  hello-world.S > hello-world.s`
3. run `arm-none-eabi-as -mcpu=cortex-m0plus -mthumb -gstabs  -o hello-world.o
hello-world.s`
4. run `arm-none-eabi-ld hello-world.o -o hello-world`
5. run `qemu-arm-static -cpu cortex-m0 -g 10101 hello-world`
6. In another terminal run:
```
gdb-multiarch -q \
        -ex "set confirm off" \
        -ex "file hello-world" \
        -ex "target remote localhost:10101" \
        -ex "set confirm on"
```
7. In the gdb prompt, type `tui reg general`.

Expected result:
1. Should see register values

Actual result:
1. Assertion triggered, rendering broken. See images at github repo linked
below
2. After entering `y` at the Create core file prompt:
```
Create a core file of GDB? (y or n) yAborted (core dumped)
    ---------------------                                 make: *** 
```
Core file attached to this bug.

Github repository with makefile setup for reproduction available at
https://github.com/Nashenas88/gdb-multiarch-bug

Version information:
```
$ uname -a
Linux pop-os 6.0.6-76060006-generic #202210290932~1669062050~22.04~d94609a SMP
PREEMPT_DYNAMIC Mon N x86_64 x86_64 x86_64 GNU/Linux
```

apt deps: `sudo apt install qemu-user-static gdb-multiarch
gcc-arm-linux-gnueabihf`

```
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1 20210621 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

```
$ arm-none-eabi-as --version
GNU assembler (2.38-3ubuntu1+15build1) 2.38
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-none-eabi'.
```

```
$ arm-none-eabi-ld --version
GNU ld (2.38-3ubuntu1+15build1) 2.38
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
```

```
$ qemu-arm-static --version
qemu-arm version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.6)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
```

```
$ gdb-multiarch --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ gdb-multiarch --configuration
This GDB was configured as follows:
   configure --host=x86_64-linux-gnu --target=x86_64-linux-gnu
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb (relocatable)
             --with-jit-reader-dir=/usr/lib/gdb (relocatable)
             --without-libunwind-ia64
             --with-lzma
             --with-babeltrace
             --with-intel-pt
             --with-mpfr
             --with-xxhash
             --with-python=/usr (relocatable)
             --with-python-libdir=/usr/lib (relocatable)
             --with-debuginfod
             --without-guile
             --enable-source-highlight
             --with-separate-debug-dir=/usr/lib/debug (relocatable)
             --with-system-gdbinit=/etc/gdb/gdbinit
             --with-system-gdbinit-dir=/etc/gdb/gdbinit.d

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)
```

Contents of `~/.gdbinit`:
```
tui new-layout arm {-horizontal asm 1 regs 1} 2 status 0 cmd 1
set auto-load safe-path /
```

# Possible clue?
The issue seems to come from the `#` lines generated by compilation of the `.s`
file from the `.S` file. If I remove the `#` lines from the `.s` file, the
error stops occurring.

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

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

* [Bug gdb/29943] Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S
  2022-12-26 20:14 [Bug gdb/29943] New: Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S pauldfaria at gmail dot com
@ 2022-12-28 10:40 ` vries at gcc dot gnu.org
  2023-01-05 13:18 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2022-12-28 10:40 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Looks like the problem fixed by commit cb25fdbb76e ("gdb: remove assertion in
psymbol_functions::expand_symtabs_matching").

We should probably try to backport this to gdb-12-branch.

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

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

* [Bug gdb/29943] Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S
  2022-12-26 20:14 [Bug gdb/29943] New: Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S pauldfaria at gmail dot com
  2022-12-28 10:40 ` [Bug gdb/29943] " vries at gcc dot gnu.org
@ 2023-01-05 13:18 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2023-01-05 13:18 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |13.1
         Resolution|---                         |FIXED

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Looks like the problem fixed by commit cb25fdbb76e ("gdb: remove assertion
> in psymbol_functions::expand_symtabs_matching").
> 
> We should probably try to backport this to gdb-12-branch.

Hmm, I don't have an easy reproducer, and I would have to reproduce it on
gdb-12-branch to be allowed to backport it.

So, I'm leaving this as is, and closing it as fixed in 13.1.

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

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

end of thread, other threads:[~2023-01-05 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 20:14 [Bug gdb/29943] New: Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S pauldfaria at gmail dot com
2022-12-28 10:40 ` [Bug gdb/29943] " vries at gcc dot gnu.org
2023-01-05 13:18 ` 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).