[lldb] Implement CrashReason using UnixSignals
authorDavid Spickett <david.spickett@linaro.org>
Tue, 14 Mar 2023 11:52:36 +0000 (11:52 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Mon, 20 Mar 2023 11:39:32 +0000 (11:39 +0000)
commit0107513fe79da7670e37c29c0862794a2213a89c
tree93d9e1f589986bf68b3db48f27ab556a3c9c2de9
parent2d4042f4b78ebd4303f558c01b67f8ecabfe47e6
[lldb] Implement CrashReason using UnixSignals

By adding signal codes to UnixSignals and adding a new function
where you can get a string with optional address and bounds.

Added signal codes to the Linux, FreeBSD and NetBSD signal sets.
I've checked the numbers against the relevant sources.

Each signal code has a code number, description and printing options.
By default you just get the descripton, you can opt into adding either
a fault address or bounds information.

Bounds signals we'll use the description, unless we have the bounds
values in which case we say whether it is an upper or lower bound
issue.

GetCrashReasonString remains in CrashReason because we need it to
be compiled only for platforms with siginfo_t. Ideally it would
move into NativeProcessProtocol, but that is also used
by NativeRegisterContextWindows, where there would be no siginfo_t.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D146044
lldb/include/lldb/Target/UnixSignals.h
lldb/source/Plugins/Process/POSIX/CrashReason.cpp
lldb/source/Plugins/Process/Utility/FreeBSDSignals.cpp
lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
lldb/source/Plugins/Process/Utility/NetBSDSignals.cpp
lldb/source/Target/UnixSignals.cpp
lldb/unittests/Signals/UnixSignalsTest.cpp