LoginSignup
1
1

More than 1 year has passed since last update.

Ubuntu で core ファイルが出力されない

Last updated at Posted at 2022-08-25

core がない

備忘録です。

ubuntuバージョン
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"

(1) コアファイルの出力先
apport障害情報ツールになっていますので変更します。

出力先の確認
$ sysctl -a | grep core_pattern
 ...
kernel.core_pattern = |/usr/share/apport/apport %p %s %c %d %P %E

tmpに出力、ファイル名は任意で変更 (tmpは再起動でクリア)

出力先の変更
sudo sysctl -w kernel.core_pattern="/tmp/core_%e_%p_%t"

(2) コアファイルのサイズ
が0なので出力されません

サイズの確認
$ ulimit -c
0

無制限に設定

サイズの設定
$ ulimit -S -c unlimited
$ ulimit -c  # 確認
unlimited

(3) コア生成
hoge落とす Segmentation fault (コアダンプ)

core 確認
$ ls core*
core_hoge_2297_1661404598

あとは gdb でデバッグですね。

gdb
$ gdb hoge core_hoge_2297_1661404598
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
...
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1