Compile options of shared library:
g++ -DNO_STORAGE -Wall -DDEBUG_BUILD -O0 -ggdb3 -DLOG_OUTPUT -fPIC
Compile options of executable:
g++ -Wall -O0 -std=c++11 -ggdb3 -c -Iinc -IDRAMSim2 -LDRAMSim2 -ldramsim
link options:
g++ -LDRAMSim2/ -ldramsim -ggdb3
As you can see, I use -ggdb3
everywhere. But still when I try single stepping in
a function of the shared library, I get:
Single stepping until exit from function _ZN7DRAMSim14addressMappingEmRjS0_S0_S0_S0_@plt, which has no line number information.
I have set LD_PRELOAD
and LD_LIBRARY_PATH
, neither works.
info shared
gives the path of shared libraries which have been linked, /media/psf/Home/box/champsim/ChamSim-CS422A/DRAMSim2/libdramsim.so
is exactly what I build with -ggdb3
.
(gdb) info shared
From To Syms Read Shared Object Library
0x00007ffff7fd0100 0x00007ffff7ff2674 Yes /lib64/ld-linux-x86-64.so.2
0x00007ffff7f825c0 0x00007ffff7faf504 Yes /media/psf/Home/box/champsim/ChamSim-CS422A/DRAMSim2/libdramsim.so
0x00007ffff7ddd160 0x00007ffff7ec5452 Yes (*) /usr/lib/x86_64-linux-gnu/libstdc++.so.6
0x00007ffff7d275e0 0x00007ffff7d38045 Yes (*) /lib/x86_64-linux-gnu/libgcc_s.so.1
0x00007ffff7b54630 0x00007ffff7cc918d Yes /lib/x86_64-linux-gnu/libc.so.6
0x00007ffff79f03c0 0x00007ffff7a96f18 Yes /lib/x86_64-linux-gnu/libm.so.6
Also, file
command shows the shared library has debug information.
$ file /media/psf/Home/box/champsim/ChamSim-CS422A/DRAMSim2/libdramsim.so
/media/psf/Home/box/champsim/ChamSim-CS422A/DRAMSim2/libdramsim.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=243a1ab772b321d27e5cb1906108cb26e99895b5, with debug_info, not stripped
platform(ubuntu 20.04):
$ uname -a
Linux ubuntu 5.4.0-97-generic #110-Ubuntu SMP Thu Jan 13 18:22:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
gdb version:
$ gdb -v
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
g++ version:
$ g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0