[GAS PATCH] intercept signal crashes

Nathan Sidwell nathan@acm.org
Thu Jan 12 16:42:00 GMT 2017


gas's fatal signal handling is not as nice as gcc's has become.  This 
patch is a move towards fixing that.

1) rather than have as_assert and as_abort fatal error functions with 
almost the same behaviour -- they differ only in their initial message. 
This patch kills 'as_assert' and rewords 'as_abort' to meet assert fail 
behaviour.  So now on a failed assert, instead of:
   Internal error!
   Assertion failure in FOO at BAZ:17.
   Please report this bug.
we get
   Internal error in FOO at BAZ:17.
   Please report this bug.

That's now the same message for any explicit call to 'abort'.

2) Added a signal handler to catch SEGV, ILL, BUS, ABRT, IOT and FPE 
(when they exist), and forward it to as_abort using a NULL FILE, so we 
get a message such as:
   Internal error (Segmentation fault).
   Please report this bug.
or in the worst case:
   Internal error (unknown).
   Please report this bug.

I tested that on an x86_64-linux system by using gdb to inject a signal 
into gas.

Most of that handling code is stolen from gcc (toplev.c, diagnostic.c 
and system.h)

ok?

nathan
-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gas-sig.diff
Type: text/x-patch
Size: 6249 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170112/4ad81e8b/attachment.bin>


More information about the Binutils mailing list