Getting a core dump

Hi, I’m trying to create a test program compiled to native code that can invoke a core dump. To this effect, I create a natively compiled program (using the dune build system):
let () = while true do () done

And then I send this program different signals in order to get it to create a core dump file such as SIGSEGV, SIGINT, etc. However, everytime, the program just terminates with a ‘Terminated’ without creating a core dump file.

I’ve checked a bunch of things such as ulimit, location of core, possible conflicting names and I can see other programs doing a core dump. Therefore, my feeling is that it’s something to do with the ocaml program itself.

Any ideas would be appreciated. Thanks!

Use

$ kill -QUIT <pid>

But you’ll need to ensure that core dumps are permitted:

$ ulimit -a
core file size          (blocks, -c) unlimited
...
2 Likes

You can also use radare2 builtin feature to generate and open coredumps. See dg command, more at Debugging section of radare2 book. Alternatively, you can use gdb embedded feature to generate core files as well.

1 Like

Thanks! That worked!