What is a good way to dump a Linux core file from inside a process?

前端 未结 8 1996
醉梦人生
醉梦人生 2020-12-08 23:14

We have a server (written in C and C++) that currently catches a SEGV and dumps some internal info to a file. I would like to generate a core file and write it to disk at th

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 23:26

    Google has a library for generating coredumps from inside a running process called google-coredumper. This should ignore ulimit and other mechanisms.

    The documentation for the call that generates the core file is here. According to the documentation, it seems that it is feasible to generate a core file in a signal handler, though it is not guaranteed to always work.

提交回复
热议问题