I use Ubuntu 14.04
I try using https://github.com/KDE/heaptrack for detect memory leaks in my running C++ program
when heaptrack shell script running
gdb --batch-silent -n -iex="set auto-solib-add off" -p $pid \
--eval-command="sharedlibrary libdl" \
--eval-command="call (void) dlmopen(0x00, \"$LIBHEAPTRACK_INJECT\", 0x002)" \
--eval-command="sharedlibrary libheaptrack_inject" \
--eval-command="call (void) heaptrack_inject(\"$pipe\")" \
--eval-command="detach"
i see following error messages
No symbol "dlmopen" in current context.
No symbol "heaptrack_inject" in current context.
and when i run gdb manually
gdb -p XXX
(gdb) sharedlibrary libdl
i see other error message
No loaded shared libraries match the pattern `libdl'.
but libdl.so exists in my filesystem
# find / -name libdl*.so
/usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.19.so
/usr/lib/x86_64-linux-gnu/libdl.so
/lib/x86_64-linux-gnu/libdl-2.19.so
Why gdb don't load libdl over sharedlibrary command ?
Why gdb don't load libdl over sharedlibrary command ?
This message:
No loaded shared libraries match the pattern `libdl'.
means that your inferior (being debugged) process does not link against libdl
. You can find all libraries that your inferior has with (gdb) info shared
, and confirm that libdl
is not among them.
GDB does not by itself modify the set of loaded libraries.
find / -name libdl*.so
This is irrelevant. The libdl.so
exists, but that doesn't mean that every process loads it (your process doesn't).