Documentation Home
MySQL 8.0 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 36.1Mb
PDF (A4) - 36.2Mb


このページは機械翻訳したものです。

5.9.1.5 スタックトレースの使用

オペレーティングシステムによっては、mysqld が予期せずに異常終了した場合に、エラーログにスタックトレースが含まれています。 これを使用して、mysqld が異常終了した場所 (および多くの場合その理由) を見つけることができます。 セクション5.4.2「エラーログ」 を参照してください。 スタックトレースを取得するには、-fomit-frame-pointer オプションを gcc に指定して mysqld をコンパイルしないでください。 セクション5.9.1.1「デバッグのための MySQL のコンパイル」を参照してください。

エラーログのスタックトレースは次のように出力されます。

Press CTRL+C to copy
mysqld got signal 11; Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 0x41fd0110 thread_stack 0x40000 mysqld(my_print_stacktrace+0x32)[0x9da402] mysqld(handle_segfault+0x28a)[0x6648e9] /lib/libpthread.so.0[0x7f1a5af000f0] /lib/libc.so.6(strcmp+0x2)[0x7f1a5a10f0f2] mysqld(_Z21check_change_passwordP3THDPKcS2_Pcj+0x7c)[0x7412cb] mysqld(_ZN16set_var_password5checkEP3THD+0xd0)[0x688354] mysqld(_Z17sql_set_variablesP3THDP4ListI12set_var_baseE+0x68)[0x688494] mysqld(_Z21mysql_execute_commandP3THD+0x41a0)[0x67a170] mysqld(_Z11mysql_parseP3THDPKcjPS2_+0x282)[0x67f0ad] mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xbb7[0x67fdf8] mysqld(_Z10do_commandP3THD+0x24d)[0x6811b6] mysqld(handle_one_connection+0x11c)[0x66e05e]

トレースの関数名の解決に失敗した場合、トレースに格納される情報が少なくなります。

Press CTRL+C to copy
mysqld got signal 11; Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 0x41fd0110 thread_stack 0x40000 [0x9da402] [0x6648e9] [0x7f1a5af000f0] [0x7f1a5a10f0f2] [0x7412cb] [0x688354] [0x688494] [0x67a170] [0x67f0ad] [0x67fdf8] [0x6811b6] [0x66e05e]

新しいバージョンの glibc スタックトレース関数では、オブジェクトへの相対アドレスも出力されます。 glibc ベースのシステム (Linux) では、プラグイン内の予期しない終了のトレースは次のようになります:

Press CTRL+C to copy
plugin/auth/auth_test_plugin.so(+0x9a6)[0x7ff4d11c29a6]

相対アドレス (+0x9a6) をファイル名および行番号に変換するには、次のコマンドを使用します。

Press CTRL+C to copy
shell> addr2line -fie auth_test_plugin.so 0x9a6 auth_test_plugin mysql-trunk/plugin/auth/test_plugin.c:65

addr2line ユーティリティーは Linux の binutils パッケージの一部です。

Solaris でも手順は同様です。 Solaris の printstack() では、相対アドレスがすでに出力されています。

Press CTRL+C to copy
plugin/auth/auth_test_plugin.so:0x1510

これを変換するには、次のコマンドを使用します。

Press CTRL+C to copy
shell> gaddr2line -fie auth_test_plugin.so 0x1510 mysql-trunk/plugin/auth/test_plugin.c:88

Windows では、アドレス、関数名、および行がすでに出力されています。

Press CTRL+C to copy
000007FEF07E10A4 auth_test_plugin.dll!auth_test_plugin()[test_plugin.c:72]