问题
I'm trying to run application in gdb but it seem's I have problem with debbuger. I cannot load shared libraries all the ways I've tried to.
Libraries are stored in /usr/local/lib64 and environment is ok:
echo $LD_LIBRARY_PATH
/usr/local/lib64:/home/user/lib
When I run appllication in gdb, the following happens:
(gdb) set solib-search-path /usr/local/lib64
(gdb) show solib-search-path The search path for loading non-absolute
shared library symbol files is /usr/local/lib64.
(gdb) info sharedlibrary No shared libraries loaded at this time.
and I can't set any breakpoint to debug my app, but at the same time app is running ok in gdb and debug symbols are reading from binaries!
I guess, the problem is related with permissions but don't know exactly where it is.
To avoid any misunderstanding, I should notice that my application runs good and I don't have any troubles with access to shared libraries.
回答1:
When I run appllication in gbd, the following happens:
You haven't actually run the application yet, so "no shared libraries loaded at this time" is correct and expected.
You need to actually execute the GDB run command.
Update:
I can execute run command and that's a strange thing.
No, it's not a strange thing. You don't have a problem, everything is working as expected.
I am guessing that your real problem is that you can't set breakpoints in shared libraries that your application is using. A solution for that problem is to do this:
gdb /path/to/app
(gdb) start
# Application stops at main.
# You can now set any breakpoint you want.
(gdb) break foo.c:123
来源:https://stackoverflow.com/questions/28352379/cannot-load-shared-libraries-in-gdb