1

使用 SOCI 行集时出现分段错误。这是我的代码的简化版本:

query << "select * from mytable";
soci::rowset<MyObject> rs = (sql.prepare << query.str());

以下是 gdb 的摘录:

Thread 3 "MyProgram" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffef14c700 (LWP 15369)]
0x00007ffff6b73428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff6b73428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff6b7502a in __GI_abort () at abort.c:89
#2  0x00007ffff6bc0503 in malloc_printerr (ar_ptr=<optimized out>, ptr=<optimized out>, str=<optimized out>, action=<optimized out>) at malloc.c:5010
#3  _int_malloc (av=av@entry=0x7ffff6f02b20 <main_arena>, bytes=bytes@entry=33) at malloc.c:3386
#4  0x00007ffff6bc0e59 in malloc_check (sz=32, caller=<optimized out>) at hooks.c:295
#5  0x0000000001307668 in operator new(unsigned long) ()
#6  0x0000000001298b25 in soci::postgresql_statement_backend::make_into_type_backend() ()
#7  0x00000000012941b4 in soci::details::standard_into_type::define(soci::details::statement_impl&, int&) ()
#8  0x000000000128fd13 in soci::details::statement_impl::define_for_row() ()
#9  0x0000000001292be8 in soci::details::statement_impl::execute(bool) ()
#10 0x0000000000db420a in soci::statement::execute (this=0x3d261d0, withDataExchange=false) at /usr/include/soci/statement.h:210
#11 0x0000000001076d46 in soci::details::rowset_impl<MyObject>::rowset_impl (this=0xb027c80, prep=...) at /usr/include/soci/rowset.h:126
#12 0x0000000001072fb1 in soci::rowset<sim_mob::SinglePath>::rowset (this=0x7fffef14a890, prep=...) at /usr/include/soci/rowset.h:185
4

0 回答 0