@@ -49,17 +49,16 @@ using namespace lldb_private;
4949
5050// Construct a Thread object with given data
5151ThreadElfCore::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)) {}
5455
5556ThreadElfCore::~ThreadElfCore () { DestroyThread (); }
5657
5758void ThreadElfCore::RefreshStateAfterStop () {
5859 GetRegisterContext ()->InvalidateIfNeeded (false );
5960}
6061
61-
62-
6362RegisterContextSP ThreadElfCore::GetRegisterContext () {
6463 if (!m_reg_context_sp) {
6564 m_reg_context_sp = CreateRegisterContextForFrame (nullptr );
@@ -246,9 +245,15 @@ bool ThreadElfCore::CalculateStopInfo() {
246245 if (!unix_signals_sp)
247246 return false ;
248247
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+
249255 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 ));
252257
253258 SetStopInfo (m_stop_info_sp);
254259 return true ;
@@ -561,6 +566,8 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch,
561566 return error;
562567 }
563568
569+ // Set that we've parsed the siginfo from a SIGINFO note.
570+ note_type = eNT_SIGINFO;
564571 // Parsing from a 32 bit ELF core file, and populating/reusing the structure
565572 // properly, because the struct is for the 64 bit version
566573 offset_t offset = 0 ;
@@ -592,18 +599,20 @@ Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch,
592599 return error;
593600}
594601
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 ) {
598605 if (sigfault.bounds ._addr_bnd ._upper != 0 )
599606 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 ,
602608 sigfault.bounds ._addr_bnd ._upper );
603609 else
604610 return unix_signals.GetSignalDescription (si_signo, si_code,
605- sigfault.si_addr );
611+ sigfault.si_addr );
606612 }
607613
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 ();
609618}
0 commit comments