abort() missing return-address => useless core file

Grant Edwards grant.b.edwards at gmail.com
Fri Nov 4 03:08:25 UTC 2011


On 2011-11-04, Rich Felker <dalias at aerifal.cx> wrote:
> On Thu, Nov 03, 2011 at 01:23:30PM +0000, Grant Edwards wrote:
>> It appears that the abort() function somehow breaks the resulting
>> corefile so that you can't do a post-mortem backtrace.  I suspect that
>> gcc has figured out that the abort() function never returns, so it
>> doesn't push a return address onto the stack.
>> 
>> I've managed to work around the problem by doing something like this
>> to cause a segfault instead of calling abort():
>> 
>>   *((volatile char*)0) = 0;
>> 
>> That produces a usable core file.
>>   
>> But, it would be nice if abort() could be "fixed" somehow...
>
> This probably just entails eliminating the noreturn attribute from the
> prototype...

That's what I thought at first, but when I looked at the source code I
couldn't find it...  Ah, there it is... I finally found the include
files by switching to the "future" branch.  There are no include files
under "master" for some reason.  Well, there are now, but 10 minutes
ago it said "no repository found". :/

Removing the __noreturn__ attribute from abort's declaration seems
like a pretty good idea if it makes core files usable.  It's not like
adding one instruction and taking up one word of stack space is really
worth the sacrifice in the case of abort().  Premature optimization
rears it's ugly head once again... ;)

-- 
Grant






More information about the uClibc mailing list