@@ -49,17 +49,16 @@ using namespace lldb_private;
49
49
50
50
// Construct a Thread object with given data
51
51
ThreadElfCore::ThreadElfCore (Process &process, const ThreadData &td)
52
- : Thread(process, td.tid), m_thread_reg_ctx_sp(),
53
- m_gpregset_data(td.gpregset), m_notes(td.notes), m_siginfo(std::move(td.siginfo)) {}
52
+ : Thread(process, td.tid), m_thread_reg_ctx_sp(), m_thread_name(td.name),
53
+ m_gpregset_data(td.gpregset), m_notes(td.notes),
54
+ m_siginfo(std::move(td.siginfo)) {}
54
55
55
56
ThreadElfCore::~ThreadElfCore () { DestroyThread (); }
56
57
57
58
void ThreadElfCore::RefreshStateAfterStop () {
58
59
GetRegisterContext ()->InvalidateIfNeeded (false );
59
60
}
60
61
61
-
62
-
63
62
RegisterContextSP ThreadElfCore::GetRegisterContext () {
64
63
if (!m_reg_context_sp) {
65
64
m_reg_context_sp = CreateRegisterContextForFrame (nullptr );
@@ -246,9 +245,15 @@ bool ThreadElfCore::CalculateStopInfo() {
246
245
if (!unix_signals_sp)
247
246
return false ;
248
247
248
+ const char *sig_description;
249
+ std::string description = m_siginfo.GetDescription (*unix_signals_sp);
250
+ if (description.empty ())
251
+ sig_description = nullptr ;
252
+ else
253
+ sig_description = description.c_str ();
254
+
249
255
SetStopInfo (StopInfo::CreateStopReasonWithSignal (
250
- *this , m_siginfo.si_signo ,
251
- m_siginfo.GetDescription (*unix_signals_sp).c_str (), m_siginfo.si_code ));
256
+ *this , m_siginfo.si_signo , sig_description, m_siginfo.si_code ));
252
257
253
258
SetStopInfo (m_stop_info_sp);
254
259
return true ;
@@ -561,6 +566,8 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch,
561
566
return error;
562
567
}
563
568
569
+ // Set that we've parsed the siginfo from a SIGINFO note.
570
+ note_type = eNT_SIGINFO;
564
571
// Parsing from a 32 bit ELF core file, and populating/reusing the structure
565
572
// properly, because the struct is for the 64 bit version
566
573
offset_t offset = 0 ;
@@ -592,18 +599,20 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch,
592
599
return error;
593
600
}
594
601
595
- std::string
596
- ELFLinuxSigInfo::GetDescription ( const lldb_private::UnixSignals &unix_signals) const {
597
- if (unix_signals.GetShouldStop (si_signo) && sigfault. si_addr != 0 ) {
602
+ std::string ELFLinuxSigInfo::GetDescription (
603
+ const lldb_private::UnixSignals &unix_signals) const {
604
+ if (unix_signals.GetShouldStop (si_signo) && note_type == eNT_SIGINFO ) {
598
605
if (sigfault.bounds ._addr_bnd ._upper != 0 )
599
606
return unix_signals.GetSignalDescription (
600
- si_signo, si_code, sigfault.si_addr ,
601
- sigfault.bounds ._addr_bnd ._lower ,
607
+ si_signo, si_code, sigfault.si_addr , sigfault.bounds ._addr_bnd ._lower ,
602
608
sigfault.bounds ._addr_bnd ._upper );
603
609
else
604
610
return unix_signals.GetSignalDescription (si_signo, si_code,
605
- sigfault.si_addr );
611
+ sigfault.si_addr );
606
612
}
607
613
608
- return unix_signals.GetSignalDescription (si_signo, si_code);
614
+ // This looks weird, but there is an existing pattern where we don't pass a
615
+ // description to keep up with that, we return empty here, and then the above
616
+ // function will set the description whether or not this is empty.
617
+ return std::string ();
609
618
}
0 commit comments