public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31256] New: [14 regression] Crash with basic 'list .'
@ 2024-01-18 4:57 sam at gentoo dot org
2024-01-18 18:26 ` [Bug gdb/31256] " ssbssa at sourceware dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: sam at gentoo dot org @ 2024-01-18 4:57 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] [14 regression] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
@ 2024-01-18 18:26 ` ssbssa at sourceware dot org
2024-01-18 18:39 ` sam at gentoo dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-18 18:26 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] [14 regression] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sam at gentoo dot org @ 2024-01-18 18:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |blarsen at redhat dot com
--- Comment #1 from Sam James <sam at gentoo dot org> ---
The original reporter Christopher Fore has bisected it to
commit 3e3a1874fcec34bcf51b4baf4be09aebab561bff
Author: Bruno Larsen <blarsen@redhat.com>
Date: Thu Jun 15 12:14:22 2023 +0200
gdb/cli: add '.' as an argument for 'list' command
Currently, after the user has used the list command once, there is no
self-contained way to ask GDB to print the location where the inferior is
stopped. The current best options require either using a separate
command to scope out where the inferior is stopped, or using "list *$pc"
requiring knowledge of GDB standard registers. This commit adds a way
to do that using '.' as a new argument for the 'list' command. If the
inferior isn't running, the command prints around the main function.
Because this necessitated having the inferior running and the test was
(seemingly unnecessarily) using printf in a non-essential way and it
would make the resulting log harder to read for no benefit, it was
replaced by a different statement.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
.. which added the feature
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] [14 regression] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: csfore at posteo dot net @ 2024-01-18 19:43 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Christopher Fore <csfore at posteo dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |csfore at posteo dot net
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] [14 regression] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: csfore at posteo dot net @ 2024-01-18 22:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
--- Comment #2 from Christopher Fore <csfore at posteo dot net> ---
After some trial and error I discovered that the root cause seems to be the
`list .` command does not properly function when a program is compiled without
debugging symbols. When you compile the test program with `-ggdb3` it functions
normally.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (3 preceding siblings ...)
2024-01-18 22:33 ` csfore at posteo dot net
@ 2024-01-19 8:44 ` blarsen at redhat dot com
2024-01-23 15:19 ` blarsen at redhat dot com
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: blarsen at redhat dot com @ 2024-01-19 8:44 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Guinevere Larsen <blarsen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14 regression] Crash with |Crash with basic 'list .'
|basic 'list .' |
Status|NEW |ASSIGNED
--- Comment #3 from Guinevere Larsen <blarsen at redhat dot com> ---
I just reproduced it with upstream GDB, and see it is still there.
Sorry, when I was developing the "list ." command, I never
--- Comment #4 from Guinevere Larsen <blarsen at redhat dot com> ---
(...) I never tested with an inferior without debuginfo.
IMO, the whole "list" command doesn't handle missing debug information all too
well. I'll try to tackle both and fix this as soon as possible.
PS: sorry for double updates, it was a misclick
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: blarsen at redhat dot com @ 2024-01-23 15:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
--- Comment #5 from Guinevere Larsen <blarsen at redhat dot com> ---
I have an upstream patch already for this issue here[1]. This should be fixed
as soon as people look/approve it.
[1]
https://inbox.sourceware.org/gdb-patches/20240123105043.39408-1-blarsen@redhat.com/T/#u
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: csfore at posteo dot net @ 2024-01-23 15:43 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
--- Comment #6 from Christopher Fore <csfore at posteo dot net> ---
Thank you! Just tested on head and 14.1 and both worked.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (6 preceding siblings ...)
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
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-23 15:59 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
--- Comment #7 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Guinevere Larsen
<blarsen@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0068bd6fb3579dd8df7561e038cb3fe27f122b0e
commit 0068bd6fb3579dd8df7561e038cb3fe27f122b0e
Author: Guinevere Larsen <blarsen@redhat.com>
Date: Mon Jan 22 10:13:52 2024 +0100
gdb: fix "list ." related crash
When a user attempts to use the "list ." command with an inferior that
doesn't have debug symbols, GDB would crash. This was reported as PR
gdb/31256.
The crash would happen when attempting to get the current symtab_and_line
for the stop location, because the symtab would return a null pointer
and we'd attempt to dereference it to print the line.
This commit fixes that by checking for an empty symtab and erroring out
of the function if it happens.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Approved-By: Tom Tromey <tom@tromey.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: blarsen at redhat dot com @ 2024-01-23 16:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Guinevere Larsen <blarsen at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Guinevere Larsen <blarsen at redhat dot com> ---
The commit above fixes the issue. It will also be backported to the gdb-14
branch.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-23 16:25 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
--- Comment #9 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The gdb-14-branch branch has been updated by Guinevere Larsen
<blarsen@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4fe1a40c7c464bde0212aa859774fe59fb71ccfe
commit 4fe1a40c7c464bde0212aa859774fe59fb71ccfe
Author: Guinevere Larsen <blarsen@redhat.com>
Date: Mon Jan 22 10:13:52 2024 +0100
gdb: fix "list ." related crash
When a user attempts to use the "list ." command with an inferior that
doesn't have debug symbols, GDB would crash. This was reported as PR
gdb/31256.
The crash would happen when attempting to get the current symtab_and_line
for the stop location, because the symtab would return a null pointer
and we'd attempt to dereference it to print the line.
This commit fixes that by checking for an empty symtab and erroring out
of the function if it happens.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Approved-By: Tom Tromey <tom@tromey.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/31256] Crash with basic 'list .'
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
` (9 preceding siblings ...)
2024-01-23 16:25 ` cvs-commit at gcc dot gnu.org
@ 2024-02-11 4:42 ` brobecker at gnat dot com
10 siblings, 0 replies; 12+ messages in thread
From: brobecker at gnat dot com @ 2024-02-11 4:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31256
Joel Brobecker <brobecker at gnat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |brobecker at gnat dot com
Target Milestone|--- |14.2
--- Comment #10 from Joel Brobecker <brobecker at gnat dot com> ---
Added the 14.2 "target milestone" in order for our release scripts to know that
the fix was included in that release too.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-02-11 4:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 4:57 [Bug gdb/31256] New: [14 regression] Crash with basic 'list .' sam at gentoo dot org
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
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).