我的系统是多线程环境。 我只运行此功能
bool ExistTable( string tableName )
{
m_mutex.lock();
std::ostringstream ostr;
ostr << "select count(type) from sqlite_master where type='table' and name='" << tableName.c_str() << "';";
sqlite3_stmt* pStmt = nullptr;
int rc = sqlite3_open(DB_FILE_PATH, &m_pDB);
if ( rc == SQLITE_OK )
{
sqlite3_exec(m_pDB, ostr.str().c_str(), 0, 0, &msg);
}
m_mutex.unlock();
return true;
}
但是程序死了。 该程序几乎消失了。但是有时候它不会死。 因此,我运行gdb。
Thread 1 "Application" received signal SIGSEGV, Segmentation fault.
_int_malloc (av=av@entry=0x7ffff54cfb20 <main_arena>, bytes=bytes@entry=136) at malloc.c:3727
3727 malloc.c: No such file or directory.
(gdb) bt
#0 _int_malloc (av=av@entry=0x7ffff54cfb20 <main_arena>, bytes=bytes@entry=136) at malloc.c:3727
#1 0x00007ffff518f184 in __GI___libc_malloc (bytes=136) at malloc.c:2913
#2 0x00007ffff5ef6117 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#3 0x00007ffff5ed1b0c in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#4 0x00007ffff5ed3460 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#5 0x00007ffff5ed34be in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#6 0x00007ffff5f38ffd in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#7 0x00007ffff5f4a548 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#8 0x00007ffff5f4db42 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#9 0x00007ffff5f4e172 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#10 0x00007ffff5f4e4fa in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#11 0x00007ffff5f4e593 in sqlite3_prepare () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#12 0x00007ffff5f4e66b in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#13 0x00007ffff5f384a0 in sqlite3_exec () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#14 0x00007ffff5f38a3c in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#15 0x00007ffff5f38cdc in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#16 0x00007ffff5f38da0 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#17 0x00007ffff5f393ef in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#18 0x00007ffff5f39ac3 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#19 0x00007ffff5ee10ed in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#20 0x00007ffff5ee132a in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#21 0x00007ffff5f1d616 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#22 0x00007ffff5f49cc6 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#23 0x00007ffff5f4db42 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#24 0x00007ffff5f4e172 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#25 0x00007ffff5f4e4fa in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#26 0x00007ffff5f4e7d6 in sqlite3_prepare_v2 () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#27 0x00007ffff5f38270 in sqlite3_exec () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0
#28 0x00000000005b0639 in ExistTable
但是我没有任何信息。 怎么办?