[Xapian-discuss] how to debug xapian?

Olly Betts olly at survex.com
Thu Nov 5 03:42:55 GMT 2009


On Wed, Nov 04, 2009 at 06:24:53PM +0800, jiangwen jiang wrote:
>      using this g++ command: g++ -g quickstartindex.cc `xapian-config --libs
> --cxxflags` -o quickstartindex
> 
>      The problem is: I want to use gdb to step into xapian functions, to see
> function invocation in this example code.
>      for example, I set a breakpoint on line 25, and I want to use gdb step
> command to step into newdocument.set_data(), but it doesn't step into this
> function, just goto line 27.

That's what would happen if there was no debug information for libxapian, but
by default xapian-core is built with -g so there should be.

Perhaps you also have libxapian installed as a package and that is being used
instead.  Some distros strip debug symbols by default.

What does this report:

$ ldd quickstartindex|grep xapian

You didn't specify a prefix, so the libxapian you just built will have been
installed in /usr/local/lib, but the dynamic linker may be using a packaged one
in /usr/lib instead.

If that is the case, you can override by setting LD_LIBRARY_PATH before running
gdb - assuming bash is your shell:

export LD_LIBRARY_PATH=/usr/local/lib

If that isn't the cause, I don't know what's going on.  Debugging with gdb
works fine for me.

>      Or Should I use log file to debug this code, and see the function
> invocation in xapian.

Depends what you're trying to debug.

Cheers,
    Olly



More information about the Xapian-discuss mailing list