On Oct 2, 2007, at 10:15 AM, Joe Wilson wrote:
Could you recompile everything with -g to enable debugging with
line numbers in the backtrace?
Make that:
-g -DSQLITE_DEBUG=1
If FreeBSD has valgrind, running the program through that would be
useful as well.
OK, I got sqlite3 built with the above and I also put in a -O0 to
counteract any -On .
% gdb sqlite3
(gdb) r comments.db "CREATE TABLE comments (page, name, email, url,
body);"
(set breakpoint)
Starting program: /usr/public/bin/sqlite3 comments.db "CREATE TABLE
comments (page, name, email, url, body);"
Breakpoint 1, sqlite3Fts2InitHashTable (db=0x50c000, pHash=0x5119c0,
zName=0x8006e3c0b "fts2_tokenizer") at ./ext/fts2/fts2_tokenizer.c:341
341 int rc = SQLITE_OK;
(gdb) list
336 int sqlite3Fts2InitHashTable(
337 sqlite3 *db,
338 fts2Hash *pHash,
339 const char *zName
340 ){
341 int rc = SQLITE_OK;
342 void *p = (void *)pHash;
343 const int any = SQLITE_ANY;
344 char *zTest = 0;
345 char *zTest2 = 0;
(gdb) p rc
$3 = 0
(gdb) s
342 void *p = (void *)pHash;
(gdb) s
343 const int any = SQLITE_ANY;
(gdb) p p
$4 = (void *) 0x5119c0
(gdb) p db
$5 = (sqlite3 *) 0x50c000
(gdb) p zName
$6 = 0x8006e3c0b "fts2_tokenizer"
(gdb) s
344 char *zTest = 0;
(gdb) s
345 char *zTest2 = 0;
(gdb) p any
$7 = 5
(gdb) p p
$8 = (void *) 0x5119c0
(gdb) p scalarFunc
$9 = {void (sqlite3_context *, int, sqlite3_value **)} 0x8006cda30
<scalarFunc>
(gdb) p
$10 = {void (sqlite3_context *, int, sqlite3_value **)} 0x8006cda30
<scalarFunc>
(gdb) s
356 if( rc!=SQLITE_OK
(gdb) p rc
$11 = 0
(gdb) p db
$12 = (sqlite3 *) 0x50c000
(gdb) p zName
$13 = 0x8006e3c0b "fts2_tokenizer"
(gdb) p any
$14 = 5
(gdb) p p
$15 = (void *) 0x5119c0
(gdb) p scalarFunc
$16 = {void (sqlite3_context *, int, sqlite3_value **)} 0x8006cda30
<scalarFunc>
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
0x00000008006cdcae in sqlite3Fts2InitHashTable (db=0x50c000,
pHash=0x5119c0, zName=0x8006e3c0b "fts2_tokenizer") at ./ext/fts2/
fts2_tokenizer.c:356
356 if( rc!=SQLITE_OK
(gdb) p rc
$17 = 0
(gdb)
Here is the code for the above
/*
** Set up SQL objects in database db used to access the contents of
** the hash table pointed to by argument pHash. The hash table must
** been initialised to use string keys, and to take a private copy
** of the key when a value is inserted. i.e. by a call similar to:
**
** sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1);
**
** This function adds a scalar function (see header comment above
** scalarFunc() in this file for details) and, if ENABLE_TABLE is
** defined at compilation time, a temporary virtual table (see header
** comment above struct HashTableVtab) to the database schema. Both
** provide read/write access to the contents of *pHash.
**
** The third argument to this function, zName, is used as the name
** of both the scalar and, if created, the virtual table.
*/
int sqlite3Fts2InitHashTable(
sqlite3 *db,
fts2Hash *pHash,
const char *zName
){
int rc = SQLITE_OK;
void *p = (void *)pHash;
const int any = SQLITE_ANY;
char *zTest = 0;
char *zTest2 = 0;
#ifdef SQLITE_TEST
void *pdb = (void *)db;
zTest = sqlite3_mprintf("%s_test", zName);
zTest2 = sqlite3_mprintf("%s_internal_test", zName);
if( !zTest || !zTest2 ){
rc = SQLITE_NOMEM;
}
#endif
if( rc!=SQLITE_OK
|| (rc = sqlite3_create_function(db, zName, 1, any, p,
scalarFunc, 0, 0))
|| (rc = sqlite3_create_function(db, zName, 2, any, p,
scalarFunc, 0, 0))
#ifdef SQLITE_TEST
|| (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc,
0, 0))
|| (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc,
0, 0))
|| (rc = sqlite3_create_function(db, zTest2, 0, any, pdb,
intTestFunc, 0, 0))
#endif
);
sqlite3_free(zTest);
sqlite3_free(zTest2);
return rc;
}
SQLITE_TEST is not set.
Further experimentation, by setting a breakpoint on
sqlite3_create_function(), shows that this does not seem to be called
as the breakpoint is not triggered. I am not sure what is going on here
Chad
---
Chad Leigh -- Shire.Net LLC
Your Web App and Email hosting provider
chad at shire.net
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------