Gcc debugging, segmentation error (dropping kernel), but no kernel

I used to get Segmentation Fault without a kernel, then add -ggdb to the compilation command and execute this command in bash before running gcc:

 ulimit -c unlimited 

Everything was fine for a while (I got the kernel), but now I get Segmentation Fault (core dumped) , but not the kernel in the directory where the gcc command was issued? Maybe it will be somewhere else? What else can I try?

A bit more info:

  • OS: Gentoo Linux
  • Enable core dumps ELFs are included in a running kernel.
  • The application is a text editor written in gtk +

Answer: I found this in two ways:

  • find / -name "core" -ls
  • As Torek said:

    $ strace. / executable> output.txt 2> & 1

    $ grep chdir output.txt

+7
source share
1 answer

As @JonathanLeffler noted, a kernel dump is in the current directory.

You can use strace to check if the chdir () process has passed. Unfortunately, strace does not show where the kernel itself is, but:

 $ cat crash.c int main(void) { chdir("/tmp"); *(int *)0 = 0; return 0; } $ cc -o crash crash.c $ strace ./crash execve("./crash", ["./crash"], [/* 53 vars */]) = 0 ... [lots of libc trace stuff snipped] ... chdir("/tmp") = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} --- +++ killed by SIGSEGV (core dumped) +++ Segmentation fault $ ls /tmp 

and now there is a core.pid file.

+7
source

All Articles