discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Causing a core dump in GNUstep program


From: Robert Slover
Subject: Re: Causing a core dump in GNUstep program
Date: Thu, 28 Aug 2014 07:07:25 -0400


> On Aug 28, 2014, at 6:58, Riccardo Mottola <riccardo.mottola@libero.it> wrote:
> 
> Hi,
> 
> Wolfgang Lux wrote:
>>> Am 28.08.2014 um 00:58 schrieb Andreas Höschler:
>>> 
>>> >I am tracking a very hard to catch problem and therefore would like to 
>>> >purposely create a core dump via a piece of code in my program when the 
>>> >problem reoccurs (might take days or weeks). What line of code can I 
>>> >include in my GNUstep Objective-C program to create a core dump on 
>>> >purpose? Any idea?
>>   abort();
> I'd try that first, especially after the lesson in PC's hihglight code and 
> all related statements of the wild optimizations that can happen with illegal 
> code!
> 
> I couldn't find evidence however that SIGABRT is guaranteed to leave a core 
> file.
> 

You can use kill() to send other signals to your process, whether SIGABRT, 
SIGILL, SIGSEGV, SIGBUS, etc.; one of them will dump core. The abort() function 
often is defined with attributes that tell the compiler that it will never 
return, leaving the compiler free to optimize away details like setting up 
references to the calling stack frame - making a nearly worthless core file. I 
learned this the hard way. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]