[Xapian-discuss] how to debug xapian?
jiangwen jiang
jiangwen127 at gmail.com
Wed Nov 4 10:24:53 GMT 2009
Hi, Olly:
Thanks for your reply.
I will give my problems below, hoping you can give me a further help.
xapian-core-1.0.16, the lastest version on www.xapian.org.
compiling xapian-core-1.0.16 with the following command:
./configure --enable-log --enable-assertions && make && sudo make
install
and using a simple example on www.xapian.org, like this:
1 #include <xapian.h>
2 #include <xapian.h>
3 #include <iostream>
4 using namespace std;
5
6 int main(int argc, char **argv)
7 {
8 // Simplest possible options parsing: we just require three or more
9 // parameters.
10 if(argc < 4) {
11 cout << "usage: " << argv[0] <<
12 " <path to database> <document data> <document terms>" <<
endl;
13 exit(1);
14 }
15
16 // Catch any Xapian::Error exceptions thrown
17 try {
18 // Make the database
19 Xapian::WritableDatabase database(argv[1],
Xapian::DB_CREATE_OR_OPEN);
20
21 // Make the document
22 Xapian::Document newdocument;
23
24 // Put the data in the document
25 newdocument.set_data(string(argv[2]));
26
27 // Put the terms into the document
28 for (int i = 3; i < argc; ++i) {
29 newdocument.add_posting(argv[i], i - 2);
30 }
31
32 // Add the document to the database
33 database.add_document(newdocument);
34 } catch(const Xapian::Error &error) {
35 cout << "Exception: " << error.get_msg() << endl;
36 }
37}
I can compile and run this code correctly.
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.
Or Should I use log file to debug this code, and see the function
invocation in xapian.
regards
Wen
More information about the Xapian-discuss
mailing list