no source availabe when debugging into so

Doug Evans xdje42@gmail.com
Mon Mar 17 03:21:00 GMT 2014


2014-02-27 5:08 GMT-08:00 Li Li <fancyerii@gmail.com>:
> hi all,
>    I want to read codes of
> crfsuit(http://www.chokkan.org/software/crfsuite/) by debugging. But
> even I configure with --enable-debug. I still can't debug into its so.
>    this project has many directories such as frontend,lib. each
> directories contains some dynamic library. And finally compiled to an
> executable.
>    Here is what I am doing:
>    0. instal liblbfgs(http://www.chokkan.org/software/liblbfgs/), I
> have install by default path
>    1. ./configure --enable-debug
>    2. make
>    3. mkdir example and generate some train data
>
> [...]
>
>    4. gdb -tui --args frontend/.libs/crfsuite learn -a l2sgd
> example/train.crfsuite.txt.top100
>    5. break crfsuite_train_l2sgd
>        it says:Function "crfsuite_train_l2sgd" not defined.

This is expected when setting breakpoints in shared libraries before
the program has been run.
When gdb starts up it doesn't  look at which shared libraries the
program has been linked with.
It is only when the program is run, when the shared libraries are
loaded by the program, that gdb learns what the shared libraries are.
Make the breakpoint pending, and gdb will resolve it when the
associated shared library is loaded.

> Make breakpoint pending on future shared library load? (y or n)y
>    warning: no loadable sections found in added symbol-file
> system-supplied DSO at 0x7ffff7ffa000

The "no loadable sections" in system-supplied DSO is a separate problem.
Probably https://bugzilla.redhat.com/show_bug.cgi?id=312011

>        (gdb)r
>     6. it says no source availabe
>     7. (gdb) directory lib/crf/src/
>     8. step
>     it says:
>     Single stepping until exit from function crfsuite_train_train,
> which has no line number information.

I would verify the shared library in question actually was compiled
with debug info.
[i.e., don't assume --enable-debug did the right thing, go in and check.
Assuming the build process didn't split the debug information out into
another file,
does the output of "objdump -h path/to/shared-library.so" show several
.debug_* sections?]



More information about the Gdb mailing list