Disabling program core dumps

Konstantin Belousov kostikbel at gmail.com
Thu Apr 27 12:57:33 UTC 2017


On Thu, Apr 27, 2017 at 02:36:52PM +0200, Willem Jan Withagen wrote:
> Hi,
> 
> Running (googletest) tests some are expected to die: EXPECT_DEATH().
> This normally dumps a core, but since it is expected that core is rather
> useless.
> 
> Thusfar I've found the best way to limit a program to dump core (from
> within the program) is to set its RLIMIT_CORE to 0.
> 
> So I can do this before the test, and then set the old size back once
> the test is finished.
> 
> Or is there another way, like setting a flag in process state (which I
> have not been able to find)
See procctl(2) PROC_TRACE_CTL command.  Disabling tracing also disables
coredumping.


More information about the freebsd-hackers mailing list