-
Notifications
You must be signed in to change notification settings - Fork 0
GDB tips
Aleksey Midenkov edited this page Oct 7, 2018
·
1 revision
Additionally, it doesn't work when the debugging symbols are in a separate file (as implemented by dh_strip), amongst others.
But no worries! There's a simple solution. Rather than using strings, use readelf -w instead, and grep for DW_AT_comp_dir, which will give you the correct source directory to substitute.
(kde)root@dull:/home/midenok# readelf -w /usr/lib/debug/.build-id/0f/c71a3966f9e2efac55a5296c5950b024b0f2af.debug|grep DW_AT_comp_dir|head
<15> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<51d3> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<5ca0> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<7cf7> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<905f> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<dd44> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<11c61> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<13f12> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<16b47> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
<19219> DW_AT_comp_dir : (indirect string, offset: 0x1914): ./debian/build/deb/gio
(kde)root@dull:/home/midenok# readelf -w /usr/lib/debug/.build-id/dc/4a4c9d8e779072092699ea4709ea409127a561.debug|grep DW_AT_comp_dir|head
<16> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<2528e> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<6e981> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<c0fc7> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<107b36> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<13c12c> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<1776f0> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<1ae722> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<1df5ae> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
<2228e9> DW_AT_comp_dir : (indirect string, offset: 0x21abe): ./src/corelib
(kde)root@dull:/home/midenok# head .gdbinit
set substitute-path ./debian/build/deb /usr/src/glib2.0-2.54.1
set substitute-path ./src /usr/src/qtbase-opensource-src-5.9.1+dfsg/src