@@ -542,15 +542,8 @@ size_t ELFLinuxSigInfo::GetSize(const lldb_private::ArchSpec &arch) {
542542 }
543543}
544544
545- static bool IsSignalWithAddrValue (int signo) {
546- // SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP
547- // We can't use the enum here because it may not be available on windows or
548- // other platforms. We should make an LLDB platform agnostic enum for this
549- // in the future.
550- return signo == 8 || signo == 4 || signo == 11 || signo == 7 || signo == 5 ;
551- }
552-
553- Status ELFLinuxSigInfo::Parse (const DataExtractor &data, const ArchSpec &arch) {
545+ Status ELFLinuxSigInfo::Parse (const DataExtractor &data, const ArchSpec &arch,
546+ const lldb::UnixSignalsSP unix_signals_sp) {
554547 Status error;
555548 uint64_t size = GetSize (arch);
556549 if (size > data.GetByteSize ()) {
@@ -569,19 +562,21 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) {
569562 // 64b ELF have a 4 byte pad.
570563 if (data.GetAddressByteSize () == 8 )
571564 offset += 4 ;
572- if (IsSignalWithAddrValue (si_signo)) {
565+ // Not every stop signal has a valid address, but that will get resolved in
566+ // the unix_signals_sp->GetSignalDescription() call below.
567+ if (unix_signals_sp->GetShouldStop (si_signo)) {
573568 addr = data.GetAddress (&offset);
574569 addr_lsb = data.GetU16 (&offset);
575570 }
576571
577572 return error;
578573}
579574
580- std::string ELFLinuxSigInfo::GetDescription () {
581- if (IsSignalWithAddrValue (si_signo))
582- return lldb_private::UnixSignals::CreateForHost ()->GetSignalDescription (
575+ std::string
576+ ELFLinuxSigInfo::GetDescription (const lldb::UnixSignalsSP unix_signals_sp) {
577+ if (unix_signals_sp->GetShouldStop (si_signo))
578+ return unix_signals_sp->GetSignalDescription (
583579 si_signo, si_code, reinterpret_cast <uintptr_t >(addr));
584580
585- return lldb_private::UnixSignals::CreateForHost ()->GetSignalDescription (
586- si_signo, si_code);
581+ return unix_signals_sp->GetSignalDescription (si_signo, si_code);
587582}
0 commit comments