@@ -565,18 +565,37 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch,
565
565
// Not every stop signal has a valid address, but that will get resolved in
566
566
// the unix_signals_sp->GetSignalDescription() call below.
567
567
if (unix_signals_sp->GetShouldStop (si_signo)) {
568
- addr = data.GetAddress (&offset);
569
- addr_lsb = data.GetU16 (&offset);
568
+ // Instead of memcpy we call all these individually as the extractor will
569
+ // handle endianness for us.
570
+ _sigfault.sig_addr = data.GetAddress (&offset);
571
+ _sigfault.sig_addr_lsb = data.GetU16 (&offset);
572
+ if (data.GetByteSize () - offset >= sizeof (_sigfault._bounds )) {
573
+ _sigfault._bounds ._addr_bnd ._lower = data.GetAddress (&offset);
574
+ _sigfault._bounds ._addr_bnd ._upper = data.GetAddress (&offset);
575
+ _sigfault._bounds ._pkey = data.GetU32 (&offset);
576
+ } else {
577
+ // Set these to 0 so we don't use bogus data for the description.
578
+ _sigfault._bounds ._addr_bnd ._lower = 0 ;
579
+ _sigfault._bounds ._addr_bnd ._upper = 0 ;
580
+ _sigfault._bounds ._pkey = 0 ;
581
+ }
570
582
}
571
583
572
584
return error;
573
585
}
574
586
575
587
std::string
576
588
ELFLinuxSigInfo::GetDescription (const lldb::UnixSignalsSP unix_signals_sp) {
577
- if (unix_signals_sp->GetShouldStop (si_signo))
578
- return unix_signals_sp->GetSignalDescription (
579
- si_signo, si_code, addr);
589
+ if (unix_signals_sp->GetShouldStop (si_signo)) {
590
+ if (_sigfault._bounds ._addr_bnd ._upper != 0 )
591
+ return unix_signals_sp->GetSignalDescription (
592
+ si_signo, si_code, _sigfault.sig_addr ,
593
+ _sigfault._bounds ._addr_bnd ._lower ,
594
+ _sigfault._bounds ._addr_bnd ._upper );
595
+ else
596
+ return unix_signals_sp->GetSignalDescription (si_signo, si_code,
597
+ _sigfault.sig_addr );
598
+ }
580
599
581
600
return unix_signals_sp->GetSignalDescription (si_signo, si_code);
582
601
}
0 commit comments