@@ -542,15 +542,8 @@ size_t ELFLinuxSigInfo::GetSize(const lldb_private::ArchSpec &arch) {
542
542
}
543
543
}
544
544
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) {
554
547
Status error;
555
548
uint64_t size = GetSize (arch);
556
549
if (size > data.GetByteSize ()) {
@@ -569,19 +562,21 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) {
569
562
// 64b ELF have a 4 byte pad.
570
563
if (data.GetAddressByteSize () == 8 )
571
564
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)) {
573
568
addr = data.GetAddress (&offset);
574
569
addr_lsb = data.GetU16 (&offset);
575
570
}
576
571
577
572
return error;
578
573
}
579
574
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 (
583
579
si_signo, si_code, reinterpret_cast <uintptr_t >(addr));
584
580
585
- return lldb_private::UnixSignals::CreateForHost ()->GetSignalDescription (
586
- si_signo, si_code);
581
+ return unix_signals_sp->GetSignalDescription (si_signo, si_code);
587
582
}
0 commit comments