Crashes when trying to attach to a running process. I guess the issue is that "gdb was run from a dir which was deleted". Still, crashing in this case is confusing. Rather should say a message like "PWD doesn't exist" and exit, not crash. Thread 1 (Thread 0x7f620d9ca180 (LWP 430685)): #0 __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse4_2.S:173 #1 0x00007f6210f54328 in _nl_make_l10nflist (l10nfile_list=l10nfile_list@entry=0x7f62110efd98 <_nl_loaded_domains>, dirlist=dirlist@entry=0x7f62110ba4e0 <_nl_default_dirname> "/usr/share/locale", dirlist_len=18, mask=mask@entry=0, language=language@entry=0x5556b5677ed0 "en_US.UTF-8", territory=territory@entry=0x0, codeset=0x0, normalized_codeset=0x0, modifier=0x0, filename=0x5556b5677ef0 "LC_MESSAGES/gdb.mo", do_allocate=0) at ../intl/l10nflist.c:221 #2 0x00007f6210f5234f in _nl_find_domain (dirname=dirname@entry=0x7f62110ba4e0 <_nl_default_dirname> "/usr/share/locale", locale=locale@entry=0x5556b5677ed0 "en_US.UTF-8", domainname=domainname@entry=0x5556b5677ef0 "LC_MESSAGES/gdb.mo", domainbinding=domainbinding@entry=0x5556b5674460) at ./intl/finddomain.c:90 #3 0x00007f6210f51d3d in __dcigettext (domainname=<optimized out>, msgid1=0x5556b4834f08 "A fatal error internal to GDB has been detected, further\ndebugging is not possible. GDB will now terminate.\n\n", msgid2=0x0, plural=0, n=0, category=5) at ./intl/dcigettext.c:702 #4 0x00005556b43bb60e in handle_fatal_signal (sig=11) at /build/gdb-YnfO2U/gdb-13.2/gdb/event-top.c:958 #5 0x00005556b43bb777 in handle_sigsegv (sig=11) at /build/gdb-YnfO2U/gdb-13.2/gdb/event-top.c:1029 #6 <signal handler called> #7 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 #8 0x00005556b45843e2 in openp (path=path@entry=0x7ffc6ddecab0 "./io:$cwd", opts=..., opts@entry=..., string=string@entry=0x5556b7cd6df0 "../sysdeps/unix/sysv/linux/poll.c", mode=mode@entry=0, filename_opened=filename_opened@entry=0x7ffc6ddecb38) at /build/gdb-YnfO2U/gdb-13.2/gdb/source.c:887 #9 0x00005556b4584832 in find_and_open_source (filename=0x5556b7cd6df0 "../sysdeps/unix/sysv/linux/poll.c", dirname=<optimized out>, fullname=fullname@entry=0x7ffc6ddecb38) at /build/gdb-YnfO2U/gdb-13.2/gdb/../gdbsupport/enum-flags.h:146 #10 0x00005556b4584c9c in open_source_file (s=s@entry=0x5556b7a20bf0) at /build/gdb-YnfO2U/gdb-13.2/gdb/source.c:1180 #11 0x00005556b4585f82 in print_source_lines_base (s=0x5556b7a20bf0, line=29, stopline=30, flags=...) at /build/gdb-YnfO2U/gdb-13.2/gdb/source.c:1336 #12 0x00005556b4586905 in print_source_lines (s=<optimized out>, line=<optimized out>, stopline=<optimized out>, flags=...) at /build/gdb-YnfO2U/gdb-13.2/gdb/source.c:1484 #13 0x00005556b4598351 in print_frame_info (fp_opts=..., frame=..., print_level=<optimized out>, print_what=<optimized out>, print_args=<optimized out>, set_current_sal=1) at /build/gdb-YnfO2U/gdb-13.2/gdb/../gdbsupport/enum-flags.h:149 #14 0x00005556b45985fd in print_stack_frame (frame=..., print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at /build/gdb-YnfO2U/gdb-13.2/gdb/stack.c:368 #15 0x00005556b4431cf7 in print_stop_location (ws=...) at /build/gdb-YnfO2U/gdb-13.2/gdb/infrun.c:8469 #16 print_stop_event (uiout=0x5556b5777eb0, displays=displays@entry=true) at /build/gdb-YnfO2U/gdb-13.2/gdb/infrun.c:8485 #17 0x00005556b42e8c2f in cli_base_on_normal_stop (bs=<optimized out>, print_frame=<optimized out>) at /build/gdb-YnfO2U/gdb-13.2/gdb/cli/cli-interp.c:140 #18 0x00005556b443417a in std::function<void (bpstat*, int)>::operator()(bpstat*, int) const (__args#1=<optimized out>, __args#0=<optimized out>, this=0x5556b5806118) at /usr/include/c++/12/bits/std_function.h:591 #19 gdb::observers::observable<bpstat*, int>::notify (args#1=<optimized out>, args#0=0x0, this=<optimized out>) at /build/gdb-YnfO2U/gdb-13.2/gdb/../gdbsupport/observable.h:166 #20 normal_stop () at /build/gdb-YnfO2U/gdb-13.2/gdb/infrun.c:8747 #21 0x00005556b4425562 in attach_post_wait (from_tty=1, mode=ATTACH_POST_WAIT_STOP) at /build/gdb-YnfO2U/gdb-13.2/gdb/infcmd.c:2596 #22 0x00005556b4427581 in std::function<void ()>::operator()() const (this=0x5556b58887e0) at /usr/include/c++/12/bits/std_function.h:591 #23 inferior::do_all_continuations (this=0x5556b5694ba0) at /build/gdb-YnfO2U/gdb-13.2/gdb/inferior.c:182 #24 0x00005556b4418b75 in inferior_event_handler (event_type=<optimized out>) at /build/gdb-YnfO2U/gdb-13.2/gdb/inf-loop.c:57 #25 0x00005556b444358c in fetch_inferior_event () at /build/gdb-YnfO2U/gdb-13.2/gdb/infrun.c:4241 #26 0x00005556b47a3246 in gdb_wait_for_event (block=block@entry=0) at /build/gdb-YnfO2U/gdb-13.2/gdbsupport/event-loop.cc:716 #27 0x00005556b47a3d77 in gdb_do_one_event (mstimeout=mstimeout@entry=-1) at /build/gdb-YnfO2U/gdb-13.2/gdbsupport/event-loop.cc:217 #28 0x00005556b45f19f4 in wait_sync_command_done () at /build/gdb-YnfO2U/gdb-13.2/gdb/top.c:542 #29 0x00005556b45f1a45 in maybe_wait_sync_command_done (was_sync=<optimized out>) at /build/gdb-YnfO2U/gdb-13.2/gdb/top.c:559 #30 0x00005556b4484303 in catch_command_errors (command=<optimized out>, arg=arg@entry=0x7ffc6ddee22b "430603", from_tty=<optimized out>, do_bp_actions=do_bp_actions@entry=false) at /build/gdb-YnfO2U/gdb-13.2/gdb/main.c:515 #31 0x00005556b4486d3f in captured_main_1 (context=context@entry=0x7ffc6ddeda30) at /build/gdb-YnfO2U/gdb-13.2/gdb/main.c:1247 #32 0x00005556b4486f6b in captured_main (data=data@entry=0x7ffc6ddeda30) at /build/gdb-YnfO2U/gdb-13.2/gdb/main.c:1320 #33 gdb_main (args=args@entry=0x7ffc6ddeda60) at /build/gdb-YnfO2U/gdb-13.2/gdb/main.c:1345 #34 0x00005556b4215cba in main (argc=<optimized out>, argv=<optimized out>) at /build/gdb-YnfO2U/gdb-13.2/gdb/gdb.c:32
$ gdb --version GNU gdb (Debian 13.2-1) 13.2 Copyright (C) 2023 Free Software Foundation, Inc. Debian unstable x64.
A fair amount of code in gdb seems to assume that the cwd exists. I wonder what the right thing to do is here. It's a weird situation.