diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2019-09-12 10:40:59 +0200 |
---|---|---|
committer | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2019-09-12 10:40:59 +0200 |
commit | 7a28970742a8a1509917d409af14c84e1f666baa (patch) | |
tree | bcec44a834d20269ff8239fad3175df7f2c00c54 /ld/ldlang.c | |
parent | 19d16d8789cd1846c33c49f2fdab219b2c1fb4e1 (diff) | |
download | gdb-7a28970742a8a1509917d409af14c84e1f666baa.zip gdb-7a28970742a8a1509917d409af14c84e1f666baa.tar.gz gdb-7a28970742a8a1509917d409af14c84e1f666baa.tar.bz2 |
Fix signals reported for faults on Solaris
It's been a long-standing nuisance that gdb reported unaligned accesses
on Solaris/SPARC as SIGSEGV, contrary to the shells and truss which
correctly report SIGBUS instead.
I could trace this down to the fault handling code in procfs.c
(procfs_target::wait): when pr_why is set to PR_FAULTED, the current
code sets the signal based on the fault number. For one, the code gets
this wrong for FLTACCESS (the unaligned access case) where it uses
SIGSEGV. What's worse, it's completely unnecessary to make up the
signal number inside gdb. Instead, it should just take what procfs
reports to avoid mismatches, which is what this patch does. I've
completely removed the explicit handling of the various fault codes: for
one, the list has already been incomplete, lacking FLTCPCOVF which
existed since at least Solaris 8. Besides, there's no reason to error
out on unknown fault codes: either the fault causes a signal which can
then be reported from procfs, or it doesn't (as for FLTPAGE) and no
reporting is necessary.
Tested on sparcv9-sun-solaris2.11 and x86_64-pc-solaris2.11. Also
spot-checked manually for a couple of cases (unaligned access, division
by 0, NULL pointer dereference).
* procfs.c (procfs_target::wait) <PR_FAULTED>: Get signal from
prstatus.pr_lwp.pr_info instead of making it up.
Diffstat (limited to 'ld/ldlang.c')
0 files changed, 0 insertions, 0 deletions