Hello ChingChang, How big is tempString? What kind of type is it? I wonder if you're trashing the stack with the sprintf.
What happens if you replace all the sprinfs with some simple inserts inserted directly into vector? dbStatements.push_back("INSERT INTO..."); You need to simplify your test till you figure out what's wrong. C Tuesday, November 1, 2011, 7:09:09 PM, you wrote: CH> Do you know why it goes to core dump? CH> ChingChang CH> The source code is shown as below, CH> vector<string> dbStatements; CH> dbStatements.push_back( "BEGIN TRANSACTION;" ); CH> for ( int x = 0; x < 10; x++ ) { CH> sprintf( tempString, CH> "update utilization_table set CH> utilization=%5.2f,sample=%d where slot='0' and device='cavium' and CH> resource='bus' and sample='%d';", CH> ntohd(msg->bus_util[x]), CH> x, CH> x ); CH> dbStatements.push_back( tempString ); CH> sprintf( tempString, CH> "update utilization_table set CH> utilization=%5.2f,sample=%d where slot='0' and device='cavium' and CH> resource='icache' and sample='%d';", CH> 100.00-ntohd(msg->inst_hit_rate[x]), // Convert to misses CH> x, CH> x ); CH> dbStatements.push_back( tempString ); CH> sprintf( tempString, CH> "update utilization_table set CH> utilization=%5.2f,sample=%d where slot='0' and device='cavium' and CH> resource='dcache' and sample='%d';", CH> 100.00-ntohd(msg->data_hit_rate[x]), // Convert to misses CH> x, CH> x ); CH> dbStatements.push_back( tempString ); CH> } CH> dbStatements.push_back( "COMMIT;" ); CH> // populate the DB CH> vector<string>::iterator dbStatementsIter; CH> SqlQuery oper_db(operDatabase, __FILE__, __LINE__); CH> for ( dbStatementsIter = dbStatements.begin(); dbStatementsIter CH> != dbStatements.end(); dbStatementsIter++ ) { CH> oper_db.execw( *(dbStatementsIter) ); CH> } CH> dbStatements.clear(); CH> The core dump is shown as below. CH> #0 0x32e94b04 in raise () from /lib/libc.so.6 CH> #1 0x32e962f4 in abort () from /lib/libc.so.6 CH> #2 0x32e8c2a4 in __assert_fail () from /lib/libc.so.6 CH> #3 0x32ae60cc in ?? () from /ovn/lib/libsqlite3.mgmt-crd.so CH> #4 0x32b4c324 in ?? () from /ovn/lib/libsqlite3.mgmt-crd.so CH> #5 0x32ba12c0 in ?? () from /ovn/lib/libsqlite3.mgmt-crd.so CH> #6 0x32b7926c in sqlite3_step () from /ovn/lib/libsqlite3.mgmt-crd.so CH> #7 0x32b7a2c4 in sqlite3_exec () from /ovn/lib/libsqlite3.mgmt-crd.so CH> #8 0x329a9630 in SqlQuery::execw () from /ovn/lib/libPlatform.so CH> #9 0x329a98e8 in SqlQuery::execw () from /ovn/lib/libPlatform.so CH> #10 0x10010290 in NpuMessageHandler::processUtilReport CH> (this=<value optimized out>, msg=<value optimized out>, CH> nbytes=<value optimized out>) at cavium_driver.cpp:1387 CH> #11 0x10012808 in NpuMessageHandler::run (this=0x38be1008) at cavium_driver.cpp:954 CH> #12 0x328a65b0 in Thread::start_thread () from /ovn/lib/libCommon.mgmt-crd.so CH> #13 0x3278b5cc in ?? () from /lib/libpthread.so.0 CH> #14 0x32f39b88 in clone () from /lib/libc.so.6 CH> _______________________________________________ CH> sqlite-users mailing list CH> sqlite-users@sqlite.org CH> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Best regards, Teg mailto:t...@djii.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users