public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sam at gentoo dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31256] New: [14 regression] Crash with basic 'list .'
Date: Thu, 18 Jan 2024 04:57:05 +0000	[thread overview]
Message-ID: <bug-31256-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31256
           Summary: [14 regression] Crash with basic 'list .'
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Originally reported downstream in Gentoo at https://bugs.gentoo.org/922336.

Quoting the reproduction instructions which also trigger it for me:
"""
Test program:
```
int main() {}
```

Steps to reproduce:
1. emerge -1 =dev-debug/gdb-14.1
2. Compile test program (gcc/clang main.c)
3. gdb ./a.out
4. Set a breakpoint on main, `b main`
5. `run`
6. `list .` and the segfault should occur

Tested with: GCC 14, GCC 13, Clang 17 and all three resulted in a segmentation
fault. The test program was compiled with GCC and Clang as well.
"""

```
$ gdb ./main
Reading symbols from ./main...
(No debugging symbols found in ./main)
(gdb) b main
Breakpoint 1 at 0x1161
(gdb) r
Starting program: /tmp/main
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".

Breakpoint 1, 0x0000555555555161 in main ()
(gdb) list .


Fatal signal: Segmentation fault
----- Backtrace -----
0x56033a65d5aa gdb_internal_backtrace_1
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/bt-utils.c:122
0x56033a65d5aa _Z22gdb_internal_backtracev
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/bt-utils.c:168
0x56033a65d5aa _Z22gdb_internal_backtracev
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/bt-utils.c:154
0x56033a7d2704 handle_fatal_signal
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:889
0x56033a7d2902 handle_sigsegv
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:962
0x7f9c1ed8780f ???
0x56033abeadd4 _Z18symtab_to_fullnameP6symtab
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/source.c:1239
0x56033b3022bd _ZN12source_cache6ensureEP6symtab.constprop.0
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/source-cache.c:199
0x56033abebf59
_ZN12source_cache16get_source_linesEP6symtabiiPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/source-cache.c:364
0x56033abebf59 print_source_lines_base
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/source.c:1381
0x56033a6a401c
_Z18print_source_linesP6symtab18source_lines_range10enum_flagsI23print_source_lines_flagE
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/source.c:1477
0x56033a6a401c list_around_line
        cli/cli-cmds.c:1222
0x56033a6a401c list_command
        cli/cli-cmds.c:1294
0x56033a6a34b4 _Z8cmd_funcP16cmd_list_elementPKci
        cli/cli-decode.c:2735
0x56033acea8c1 _Z15execute_commandPKci
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/top.c:575
0x56033a7e243e _Z15command_handlerPKc
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:552
0x56033ad0429e
_Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:788
0x56033ad0429e tui_command_line_handler
        tui/tui-interp.c:104
0x56033a7d240a gdb_rl_callback_handler
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:259
0x7f9c1fc5be3c rl_callback_read_char
        /usr/src/debug/sys-libs/readline-8.2_p10/readline-8.2/callback.c:302
0x56033a7dbadb gdb_rl_callback_read_char_wrapper_noexcept
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:195
0x56033a7dbc1b gdb_rl_callback_read_char_wrapper
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/event-top.c:234
0x56033ad3301f stdin_event_handler
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/ui.c:155
0x56033b26af05 gdb_wait_for_event
        ../gdbsupport/event-loop.cc:716
0x56033b2fbe88 _Z16gdb_do_one_eventi.constprop.0
        ../gdbsupport/event-loop.cc:264
0x56033a96eb84 start_event_loop
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/main.c:407
0x56033a96eb84 captured_command_loop
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/main.c:471
0x56033a503214 captured_main
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/main.c:1324
0x56033a503214 _Z8gdb_mainP18captured_main_args
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/main.c:1343
0x56033a503214 main
        /usr/src/debug/dev-debug/gdb-14.1/gdb-14.1/gdb/gdb.c:39
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

This is a bug, please report it.  For instructions, see:
<https://bugs.gentoo.org/>.

^C
Segmentation fault (core dumped)
```

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

             reply	other threads:[~2024-01-18  4:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  4:57 sam at gentoo dot org [this message]
2024-01-18 18:26 ` [Bug gdb/31256] " ssbssa at sourceware dot org
2024-01-18 18:39 ` sam at gentoo dot org
2024-01-18 19:43 ` csfore at posteo dot net
2024-01-18 22:33 ` csfore at posteo dot net
2024-01-19  8:44 ` [Bug gdb/31256] " blarsen at redhat dot com
2024-01-23 15:19 ` blarsen at redhat dot com
2024-01-23 15:43 ` csfore at posteo dot net
2024-01-23 15:59 ` cvs-commit at gcc dot gnu.org
2024-01-23 16:10 ` blarsen at redhat dot com
2024-01-23 16:25 ` cvs-commit at gcc dot gnu.org
2024-02-11  4:42 ` brobecker at gnat dot com

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-31256-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).