GDB: Unable to find dynamic linker breakpoint function.
分类: LINUX
2013-09-23 19:03:51
GDB: Unable to find dynamic linker breakpoint function.
You all know how much I loooooooove GDB, so what better thing to write about after a long time away?
If you’re seeing this message:
|
and all your stack frames look like this:
|
gdb is trying to tell you that it cannot find the relevant ld library for the target it is debugging.
Huh?
Well, ld (linux-ld.so and ld.so) is responsible for locating and running all the shared libraries required by your executable. You must tell gdb where the target version of ld lives so that it can successfully track what your executable is up to.
You probably already know that when remote debugging you should have an unstripped copy of your target’s root filesystem available on your host. Then you can point gdb to the copy filesystem and it will be able to “see” the target’s files.
And that means a seamless debugging experience :-)
Since ld is a system library, you needn’t add the path to this explicitly. Just point to the “root” of the copy filesystem and gdb is clever enough to find it.
To do this, use the sysroot command:
|
You can also use:
|
as this is simply an alias for the sysroot command.
Often you will see suggestions to use:
|
However, this is checked after sysroot and is meant to be used for a list of colon separated paths to non-system libraries that you may be using on your target.
E.g. If you use a shared library from a third party for say, graphics, that isn’t part of the root filesystem, then you can set its path here.
One more tip:
If you are already connected to the target executable (with the target remote command), when you set your paths, you will get a useful confirmation of the libraries that are loaded on each command:
|
|
Once you know all your paths are set correctly, you can just add these commands to your GDB init file, to save you typing them in each time you run gdb.
Happy debugging :-)
原文地址:http://www.fayewilliams.com/2013/01/31/gdb-unable-to-find-dynamic-linker-breakpoint-function/