編集:私はそれ以来、これらの関数への引数としてstd :: 文字列を使用することをやめ、問題はなくなりました。文字列の有効期間とスコープに関連する重大なエラーのようです。何が起こっているのかをもう少しよく理解できればいいのですが、同様の異常と戦っている可能性のある他の人のために別のパンくずリストを残したいと思いました。/編集
そのため、MySQL C ++コネクタ(ソースから構築)を使用してデータベースアクセスルーチンを作成しようとしていますが、次のコードの場所で異常終了します。
//Change the active table and populate the member TableInfo object
void DatabaseInterface::ChangeTable(string tableName)
{
string sqlString;
int numFields;
int numRecords;
//Crash in this call
connection->setSchema(tableName);
//More after this, but we never get here anyway...
プログラムが終了した後、コンソールに表示されるメッセージは次のとおりです。
warning: .dynamic section for "/lib/libnsl.so.1" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fecb90 (LWP 23590)]
[Thread 0xb7fecb90 (LWP 23590) exited]
Traceback (most recent call last):
File "/usr/share/gdb/python/libstdcxx/v6/printers.py", line 469, in to_string
return self.val['_M_dataplus']['_M_p'].string (encoding, length = len)
RuntimeError: Error reading string from inferior: Input/output error
その最後のRuntimeErrorは、nullのパラメーターが関数に引数として割り当てられていることを示しているようで、次のコードにステップインすると、アドレスが割り当てられていないことがわかります。デバッガーは値を認識しますが、メモリの場所が存在しないようです。実際、メモリウィンドウで変数の場所を表示しようとすると、エラーが発生します。
bool ControlInterface::GenerateCmdSet()
{
int nRecords;
int nFields;
string sqlString;
string cardCmdTable;
cardCmdTable = "card_command";
dbInterface.ChangeTable(cardCmdTable);
ライブラリの競合やライブラリの欠落に問題がある可能性はありますか?私はLinuxに比較的慣れていないので、ディストリビューション、フレーバー、依存関係などと戦っている間は理解するのが難しいと感じています。