public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "pauldfaria at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29943] New: Gdb assertion failure on `layout reg general` for armv6-m source compiled from .S
Date: Mon, 26 Dec 2022 20:14:58 +0000	[thread overview]
Message-ID: <bug-29943-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-12-26 20:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-26 20:14 pauldfaria at gmail dot com [this message]
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

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=bug-29943-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).