diff options
author | Ed Maste <emaste@freebsd.org> | 2017-08-10 13:47:17 +0000 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2017-08-10 13:47:17 +0000 |
commit | 5e82ca353df1ce08974ab7cd5a9c29b0e742bb7a (patch) | |
tree | 2b6a2516521042ee116474a83b709b29cba71f3c /lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp | |
parent | fa66a340eb750bc72a813d92d6c6898c091c07cb (diff) | |
download | bcm5719-llvm-5e82ca353df1ce08974ab7cd5a9c29b0e742bb7a.tar.gz bcm5719-llvm-5e82ca353df1ce08974ab7cd5a9c29b0e742bb7a.zip |
Report inferior signals as signals, not exceptions, on FreeBSD
This is the FreeBSD equivalent of r238549.
This serves 2 purposes:
* LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/
SIGFPE the way it is suppose to be handled. Prior to this fix these
signals will neither create a coredump, nor exit from the debugger
or work for signal handling scenario.
* eInvalidCrashReason need not report "unknown crash reason" if we have
a valid si_signo
llvm.org/pr23699
Patch by Karnajit Wangkhem
Differential Revision: https://reviews.llvm.org/D35223
llvm-svn: 310591
Diffstat (limited to 'lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp index bd8e5abe225..e6557c2d58e 100644 --- a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp @@ -375,6 +375,7 @@ void FreeBSDThread::Notify(const ProcessMessage &message) { LimboNotify(message); break; + case ProcessMessage::eCrashMessage: case ProcessMessage::eSignalMessage: SignalNotify(message); break; @@ -395,10 +396,6 @@ void FreeBSDThread::Notify(const ProcessMessage &message) { WatchNotify(message); break; - case ProcessMessage::eCrashMessage: - CrashNotify(message); - break; - case ProcessMessage::eExecMessage: ExecNotify(message); break; @@ -577,7 +574,14 @@ void FreeBSDThread::LimboNotify(const ProcessMessage &message) { void FreeBSDThread::SignalNotify(const ProcessMessage &message) { int signo = message.GetSignal(); - SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + if (message.GetKind() == ProcessMessage::eCrashMessage) { + std::string stop_description = GetCrashReasonString( + message.GetCrashReason(), message.GetFaultAddress()); + SetStopInfo(StopInfo::CreateStopReasonWithSignal( + *this, signo, stop_description.c_str())); + } else { + SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + } } void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) { @@ -585,21 +589,6 @@ void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) { SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); } -void FreeBSDThread::CrashNotify(const ProcessMessage &message) { - // FIXME: Update stop reason as per bugzilla 14598 - int signo = message.GetSignal(); - - assert(message.GetKind() == ProcessMessage::eCrashMessage); - - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); - if (log) - log->Printf("FreeBSDThread::%s () signo = %i, reason = '%s'", __FUNCTION__, - signo, message.PrintCrashReason()); - - SetStopInfo(lldb::StopInfoSP(new POSIXCrashStopInfo( - *this, signo, message.GetCrashReason(), message.GetFaultAddress()))); -} - unsigned FreeBSDThread::GetRegisterIndexFromOffset(unsigned offset) { unsigned reg = LLDB_INVALID_REGNUM; ArchSpec arch = HostInfo::GetArchitecture(); |