I am a novice developer in Linux/C. Recently, I am developing a file system using libfuse in WSL2 Ubuntu 20.04.6 in C language, and I need to debug the code of libfuse to see the exact calling procedure. But when I try to load the .so file in GDB, it shows message 'You can't do that when your target is `exec''.
Here is the GDB message.
(gdb) dir /lib/x86_64-linux-gnu
Source directories searched: /lib/x86_64-linux-gnu:$cdir:$cwd
(gdb) load libfuse.so.2
You can't do that when your target is `exec'
And I used pkg-config fuse --cflags --libs
in Makefile to link the library during compiling .
I need to run the program in the debug mode. And I don't know how to step into the code of libfuse, but the GDB shows the follow information.
(gdb) n
Single stepping until exit from function fuse_fs_write_buf,
which has no line number information.
0x00007ffff755558b in ?? () from /lib/x86_64-linux-gnu/libfuse.so.2
(gdb) n
Cannot find bounds of current function
How can I deal with it?
You need install debug information for libfuse
sudo apt install libfuse-dev
.If you can't install, then build it from sources with debug info.