manywaypark's Blog
개발, 검색, 함수

'core'에 해당되는 글 1건

  1. 2014.03.21 core file은 어디에??

core file은 어디에??

tips & tricks/Linux/Unix 2014. 3. 21. 18:19 by manywaypark

아래와 같은 어마무시한 메시지가 나왔는데...

Segmentation fault (core dumped)

'코흘리던 시절 많이 보던 거지만, 간만에 보니 새롭다.' 라는 감상에 잠시 빠졌다가...

고쳐야지 하고 봤는데 파일이 없다. Orz.

분명히 core 파일은 CWD(current working directory)에 생성되는데... 잠시 맨붕.

좀 뒤져보니 그동안 많은 변화가 있었던듯...

여튼 /proc/sys/kernel/core_pattern 파일에서 core 관련 처리에 관해서 정의하고 있었고 (bar(|)로 시작하면 리다이렉션 한다든지 하는 제법 향상된 기능을 제공), 내 경우(Ubuntu) 아래와 같이 설정되어 있었고,

|/usr/share/apport/apport %p %s %c

apport라는 놈이 /var/crash에 많은 정보를 포함한 파일을 남기고 있었다.

그 파일들은 apport-unpack이라는 utility로 풀 수 있는데 그 안에 CoreDump 파일이 있었다.


ref: http://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory


happy hackin'


ps. 후일[각주:1]을 위해 간단히 backtrace하는 방법도 남김

(별거 없고 그냥 실행파일과 core 파일을 파라미터로 해서 gdb 실행 시킨후 bt 명령으로 backtrace하면 됨).

gdb /path/to/executable /path/to/CoreDump

GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04

Copyright (C) 2012 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-linux-gnu".

......

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Core was generated by `/usr/lib/erlang/erts-5.8.5/bin/beam.smp -- -root /usr/lib/erlang -progname erl'.

Program terminated with signal 11, Segmentation fault.

#0  0x00007f3528fb5f28 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)

    () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

(gdb) bt

#0  0x00007f3528fb5f28 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)

    () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

......


2018-04-03 추가[각주:2]:

core file 생성되었다는 메시지만 나오고 아무데도 생성되지 않는 경우가 발생했는데...

ulimit -a 해보면 core file size가 0으로 되어있다. 머지 이건?

여튼 ulimit -c unlimited 해준 후에 실행하면 현재 작업 디렉토리에 core 파일이 생성되었다.

ref: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory

  1. core 파일은 진짜 몇년만에 처음본다. 그래서 몇년 뒤에 참조할 일이 생길지도... [본문으로]
  2. 진짜 몇년 지나서 또 보게 되었구나. 구글링하다 갑자기 내가 쓴 글이 생각났다. Orz. [본문으로]
1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

03-29 19:33