トップページへ

gdbで「No symbol table is loaded. Use the "file" command.」というエラーが表示された場合の対処

小粋空間 » Programming Language » C/C++ » gdbで「No symbol table is loaded. Use the "file" command.」というエラーが表示された場合の対処

gdbで「No symbol table is loaded. Use the "file" command.」というエラーが表示された場合の対処方法を紹介します。

1.問題点

gdbでCプログラムの実行ファイルを起動し、ブレークポイントを設定したところ、「No symbol table is loaded. Use the "file" command.」というエラーが表示されました。

% gdb a.out
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.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/>...
Reading symbols from /home/hoge/sample/a.out...(no debugging symbols found)...done.
(gdb) b 33
No symbol table is loaded.  Use the "file" command.

ということで、「No symbol table is loaded. Use the "file" command.」というエラーが表示された場合の対処方法を紹介します。

2.原因

原因は、ビルドしたバイナリにデバッグシンボルが含まれてないためです。

3.対処

gccに"-g"オプションをつけて再ビルドしたものでgdbを実行すれば解消します。

% gdb a.out
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.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/>...
Reading symbols from /home/hoge/sample/a.out...done.
(gdb) b 33
Breakpoint 1 at 0x4009b4: file sample.c, line 33.

« 前の記事へ

次の記事へ »

トップページへ