Reputation: 33425
I use gdb (ddd) to debug my C/C++ projects.
Whenever an assert fails, I can debug the program as normal and backtrace to the assert which failed, but first I get an annoying popup
I assume raise.c
defines assert
, but ddd is looking within my home directory instead of /usr/...
or something like that.
I may or may not have the debugging packages installed (I'm on Ubuntu), but the main question is: why is gdb looking within $HOME
for this source?
Upvotes: 3
Views: 5558
Reputation: 10271
Since the glibc debuginfo package libc6-dbg
is installed on your system, gdb will look in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so
to map instruction addresses into source file names and line numbers.
The section of that file that contains the info for __GI_raise
has the following attributes that indicate where the source code might be found (on Ubuntu 16.04):
<0><688bd>: Abbrev Number: 1 (DW_TAG_compile_unit)
<688c3> DW_AT_name : (indirect string, offset: 0x9137): ../sysdeps/unix/sysv/linux/raise.c
<688c7> DW_AT_comp_dir : (indirect string, offset: 0x9010): /build/glibc-Cl5G7W/glibc-2.23/signal
Ubuntu doesn't ship source code in the base distribution, so your system doesn't have any glibc source in /build/glibc-Cl5G7W/glibc-2.23
, so gdb looks (unsuccessfully) for raise.c
in a few other directories according to its rules Specifying Source Directories and eventually gives up, with the error message
54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
Then, ddd calls SourceView::full_path("../sysdeps/unix/sysv/linux/raise.c")
to canonicalize the pathname, taking your working directory into account, and displays the error dialog box in your question.
See GDB complaining about missing raise.c for how to install glibc source on Ubuntu.
Upvotes: 3