[Xapian-discuss] seg fault on search
Michael Lewis
mal at icginc.com
Tue Jan 21 19:44:26 GMT 2014
Thanks for the response. I ran it under GDB and single stepped the queryparser call. I have a realloc() function in a common module. As soon as I stepped into the query_parser in GDB it called my realloc() instead of the one it was expecting. I removed my routine and it works fine now.
Thanks,
Michael
-----Original Message-----
From: Olly Betts [mailto:olly at survex.com]
Sent: Tuesday, January 21, 2014 2:29 PM
To: Michael Lewis
Cc: xapian-discuss at lists.xapian.org
Subject: Re: [Xapian-discuss] seg fault on search
On Tue, Jan 21, 2014 at 04:53:41PM +0000, Michael Lewis wrote:
> I have written a very simple function to return the match count based
> on the simplesearch.cc code. It fails with a seg fault. The relevant
> code is:
> --------------------
> int ftQuery(char* qs, const char* dbname,char* results, int msize) {
> long docid;
It would be better to use the type Xapian::docid instead of long, though that won't give you a segfault here.
> The query string is "austria" and it works with simplesearch.com. I
> have verified that the string is being passed to the function
> correctly as is the database name. I am out of ideas and wonder if
> anyone can point out anything that I am overlooking.
Code looks OK - I suspect the problem is elsewhere - e.g. maybe you've corrupted the malloc heap or have a stray pointer write.
If you're on a supported platform, I'd run it under valgrind, which can often spot such problems.
If you aren't, or that doesn't find anything, run it under gdb and get a backtrace for exactly where the segfault happens - that will likely give more of a clue.
Cheers,
Olly
More information about the Xapian-discuss
mailing list