Q&A
###前提・実現したいこと
gdbでsegmentation faultの原因を突き止める練習をしようとしたら、debug infoがない言われて、backtraceの内容が読めない(ように思う)
以下のサイトを丸写しして、練習しようとしました。
http://d.hatena.ne.jp/JiaLu/20120113/1330396897
debug-infoのインストールを2種類試みましたが駄目でした。
###発生している問題・エラーメッセージ
$gdb core.19267 GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... [New LWP 19267] Missing separate debuginfo for the main executable file Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c7/41ea6f7a21345e23923d10673b43c1c5586e6d Core was generated by `./test'. Program terminated with signal 11, Segmentation fault. #0 0x00007f033c93fa8d in ?? () "/path/to/core.19267" is a core file. Please specify an executable to debug.
上記のサイトだと、こんな感じででるはずなのに、
Core was generated by `./test2'. (test2がCoreを吐いている) Program terminated with signal 11, Segmentation fault. (シグナル11でプログラムが終了され、セグメンテーション違反発生) Reading symbols from /lib/tls/libc.so.6...done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 #0 0x0058668b in _IO_default_xsputn_internal () from /lib/tls/libc.so.6 (最終実行ステップはlibc.so.6ライブラリの_IO_default_xsputn_internal()関数内にある)
###試したこと
(1)gdbのエラーメッセージに従ってみた。 >> 解決せず
yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c7/41ea6f7a21345e23923d10673b43c1c5586e6d
(2)Redhatのサイトに下記を実行 >> 解決せず
https://access.redhat.com/documentation/ja-JP/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/intro.debuginfo.html
一番したのコマンドをやってみた。
# yum --enablerepo='*-debug*' install $(eu-unstrip -n --core=./core.19267 | sed -e 's#^[^ ]* \(..\)\([^@ ]*\).*$#/usr/lib/debug/.build-id/\1/\2#p' -e 's/$/.debug/')
###補足情報(言語/FW/ツール等のバージョンなど)
CentOS Linux release 7.2.1511 (Core)
gcc バージョン 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2017/07/17 00:18