Loading a core file under gdb, and then using "detach" to unload it, results in GDB crashing. It crashes in the same way on current master and in the gdb 11 & 12 branches. $ gdb -c ./core GNU gdb (GDB) 13.0.50.20220622-git ... Core was generated by `(... snip ...)'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fcce92ba2ab in ?? () [Current thread is 1 (LWP 3566803)] (gdb) detach No core file now. Fatal signal: Segmentation fault ----- Backtrace ----- 0x55e3dc868a6d gdb_internal_backtrace_1 ../../src/gdb/bt-utils.c:122 0x55e3dc868b26 _Z22gdb_internal_backtracev ../../src/gdb/bt-utils.c:168 0x55e3dca7965a handle_fatal_signal ../../src/gdb/event-top.c:946 0x55e3dca79800 handle_sigsegv ../../src/gdb/event-top.c:1019 0x7f44863be41f ??? /build/glibc-SzIz7B/glibc-2.31/nptl/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x55e3dcb432bf maybe_set_commit_resumed_all_targets ../../src/gdb/infrun.c:2899 0x55e3dcb438be _ZN29scoped_disable_commit_resumed5resetEv ../../src/gdb/infrun.c:3023 0x55e3dcb43a0b _ZN29scoped_disable_commit_resumed16reset_and_commitEv ../../src/gdb/infrun.c:3049 0x55e3dcb329cc _Z14detach_commandPKci ../../src/gdb/infcmd.c:2791 0x55e3dc8caa45 do_simple_func ../../src/gdb/cli/cli-decode.c:95 0x55e3dc8d02af _Z8cmd_funcP16cmd_list_elementPKci ../../src/gdb/cli/cli-decode.c:2514 0x55e3dce32b1e _Z15execute_commandPKci ../../src/gdb/top.c:699 0x55e3dca78dc1 _Z15command_handlerPKc ../../src/gdb/event-top.c:598 0x55e3dca792ee _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE ../../src/gdb/event-top.c:842 0x55e3dce6362d tui_command_line_handler ../../src/gdb/tui/tui-interp.c:278 0x55e3dca7848a gdb_rl_callback_handler ../../src/gdb/event-top.c:230 0x55e3dcf5a37b rl_callback_read_char ../../../src/readline/readline/callback.c:290 0x55e3dca782a6 gdb_rl_callback_read_char_wrapper_noexcept ../../src/gdb/event-top.c:188 0x55e3dca78354 gdb_rl_callback_read_char_wrapper ../../src/gdb/event-top.c:205 0x55e3dca78bc1 _Z19stdin_event_handleriPv ../../src/gdb/event-top.c:525 0x55e3dd09616b handle_file_event ../../src/gdbsupport/event-loop.cc:549 0x55e3dd09671d gdb_wait_for_event ../../src/gdbsupport/event-loop.cc:670 0x55e3dd095461 _Z16gdb_do_one_eventv ../../src/gdbsupport/event-loop.cc:210 0x55e3dcbc9b8b start_event_loop ../../src/gdb/main.c:413 0x55e3dcbc9cd6 captured_command_loop ../../src/gdb/main.c:473 0x55e3dcbcb759 captured_main ../../src/gdb/main.c:1335 0x55e3dcbcb7cb _Z8gdb_mainP18captured_main_args ../../src/gdb/main.c:1350 0x55e3dc74b6a5 main ../../src/gdb/gdb.c:32 --------------------- 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://www.gnu.org/software/gdb/bugs/>. Segmentation fault (core dumped)
Got patch.
Fix posted here: https://sourceware.org/pipermail/gdb-patches/2022-June/190259.html
Merged to both master and gdb-12-branch.
Fixed.
*** Bug 30207 has been marked as a duplicate of this bug. ***