From: Paul Smith via Gdb <gdb@sourceware.org>
To: gdb@sourceware.org
Subject: GDB 15/16 crashing in add_thread_silent()
Date: Fri, 14 Nov 2025 13:56:14 -0500 [thread overview]
Message-ID: <c90adf5e91c6f2feb57e3ade1d1b64ae6d42276d.camel@gnu.org> (raw)
Hi all;
I have a core file generated from my C++ program (running on GNU/Linux
x86_64, built with GCC 14.2). When I try to open this core file with
either GDB 15.2 or GDB 16.3 (also built by me, on GNU/Linux x86_64 with
GCC 14.2), GDB itself will crash.
I tried opening this core with GDB 8.2 built from the Red Hat source
package, provided by Rocky Linux 8.10, and this was able to open the
core (but it doesn't have other facilities I need).
I rebuilt GDB 16.3 with -ggdb3 -O0 and here's the backtrace (I elided
some of the paths etc.):
#2 0x0000000000fd266e in handle_sigsegv (sig=11) at gdb/event-top.c:1089
#3 <signal handler called>
#4 0x0000000001079a1a in std::_Hashtable<ptid_t, std::pair<ptid_t const, thread_info*>,...>::size (this=0x28)
at /cc/unknown/x86_64-unknown-linux-gnu/include/c++/14.2.0/bits/hashtable.h:657
#5 0x0000000001078df0 in std::_Hashtable<ptid_t, std::pair<ptid_t const, thread_info*>,...>::find (this=0x28,
__k=...)
at /cc/unknown/x86_64-unknown-linux-gnu/include/c++/14.2.0/bits/hashtable.h:1728
#6 0x0000000001077cba in std::unordered_map<ptid_t, thread_info*, std::hash<ptid_t>,...>::find (this=0x28, __x=...)
at /cc/unknown/x86_64-unknown-linux-gnu/include/c++/14.2.0/bits/unordered_map.h:877
#7 0x0000000001073469 in inferior::find_thread (this=0x0, ptid=...)
at gdb/inferior.c:251
#8 0x00000000013817cd in add_thread_silent (targ=0x3ed1ae0, ptid=...)
at gdb/thread.c:311
#9 0x0000000000e7e877 in core_target_open (
arg=0x7fb308098fc0 "core.9168", from_tty=1) at gdb/corelow.c:1123
#10 0x0000000000e7d210 in core_file_command (
filename=0x7fb308098fc0 "core.9168", from_tty=1) at gdb/corelow.c:724
#11 0x0000000001113774 in catch_command_errors (
command=0xe7d14f <core_file_command(char const*, int)>,
arg=0x7fb308098fc0 "core.9168", from_tty=1, do_bp_actions=false) at gdb/main.c:508
#12 0x0000000001114c5b in captured_main_1 (context=0x7fff0e4eccd0)
at gdb/main.c:1238
#13 0x00000000011152e4 in captured_main (data=0x7fff0e4eccd0)
at gdb/main.c:1333
#14 0x0000000001115384 in gdb_main (args=0x7fff0e4eccd0) at gdb/main.c:1362
#15 0x0000000000c90cf6 in main (argc=19, argv=0x7fff0e4ecdc8) at gdb/gdb.c:38
Looks like add_thread_silent() is looking up the inferior with
find_inferior_ptid() and that doesn't find anything (returns nullptr),
which is then not checked before we try to find the current thread:
thread_info *tp = inf->find_thread (ptid);
The latest Git HEAD code still seems to be missing this nullptr check.
Of course, the real question is why we can't find the inferior ptid. I
have no idea about that.
next reply other threads:[~2025-11-14 18:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 18:56 Paul Smith via Gdb [this message]
2025-11-14 19:12 ` Simon Marchi via Gdb
2025-11-14 19:20 ` Paul Smith via Gdb
2025-11-14 19:25 ` Simon Marchi via Gdb
2025-11-14 19:38 ` Paul Smith via Gdb
2025-11-14 20:03 ` Simon Marchi via Gdb
2025-11-14 20:13 ` Tom Tromey
2025-11-14 20:29 ` Paul Smith via Gdb
2025-11-14 20:42 ` Paul Smith via Gdb
2025-11-18 18:33 ` Tom Tromey
2025-11-18 19:30 ` Paul Smith via Gdb
2025-11-18 20:24 ` Simon Marchi via Gdb
2025-11-24 16:36 ` Paul Smith via Gdb
2025-11-21 11:59 ` Tom de Vries via Gdb
2025-11-24 15:19 ` Paul Smith via Gdb
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=c90adf5e91c6f2feb57e3ade1d1b64ae6d42276d.camel@gnu.org \
--to=gdb@sourceware.org \
--cc=psmith@gnu.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