mgorny created this revision. mgorny added reviewers: labath, krytarowski, emaste. mgorny requested review of this revision.
Set the current thread ID to the thread where an event happened. As a result, e.g. when a signal is delivered to a thread other than the first one, the respective T packet refers to the signaled thread rather than the first thread (with no stop reason). While this doesn't strictly make a difference to the LLDB client, some of the lldb-server tests rely on that for convenience. https://reviews.llvm.org/D117103 Files: lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp Index: lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@ -254,6 +254,7 @@ for (const auto &thread : m_threads) static_cast<NativeThreadFreeBSD &>(*thread).SetStoppedByExec(); + SetCurrentThreadID(m_threads.front()->GetID()); SetState(StateType::eStateStopped, true); return; } @@ -312,6 +313,7 @@ } else thread->SetStoppedByBreakpoint(); FixupBreakpointPCAsNeeded(*thread); + SetCurrentThreadID(thread->GetID()); } SetState(StateType::eStateStopped, true); return; @@ -333,11 +335,13 @@ if (wp_index != LLDB_INVALID_INDEX32) { regctx.ClearWatchpointHit(wp_index); thread->SetStoppedByWatchpoint(wp_index); + SetCurrentThreadID(thread->GetID()); SetState(StateType::eStateStopped, true); break; } thread->SetStoppedByTrace(); + SetCurrentThreadID(thread->GetID()); } SetState(StateType::eStateStopped, true); @@ -370,9 +374,10 @@ static_cast<NativeThreadFreeBSD &>(*abs_thread); assert(info.pl_lwpid >= 0); if (info.pl_lwpid == 0 || - static_cast<lldb::tid_t>(info.pl_lwpid) == thread.GetID()) + static_cast<lldb::tid_t>(info.pl_lwpid) == thread.GetID()) { thread.SetStoppedBySignal(info.pl_siginfo.si_signo, &info.pl_siginfo); - else + SetCurrentThreadID(thread.GetID()); + } else thread.SetStoppedWithNoReason(); } SetState(StateType::eStateStopped, true); @@ -809,6 +814,9 @@ break; } } + + if (GetCurrentThreadID() == thread_id) + SetCurrentThreadID(m_threads.front()->GetID()); } Status NativeProcessFreeBSD::Attach() {
Index: lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@ -254,6 +254,7 @@ for (const auto &thread : m_threads) static_cast<NativeThreadFreeBSD &>(*thread).SetStoppedByExec(); + SetCurrentThreadID(m_threads.front()->GetID()); SetState(StateType::eStateStopped, true); return; } @@ -312,6 +313,7 @@ } else thread->SetStoppedByBreakpoint(); FixupBreakpointPCAsNeeded(*thread); + SetCurrentThreadID(thread->GetID()); } SetState(StateType::eStateStopped, true); return; @@ -333,11 +335,13 @@ if (wp_index != LLDB_INVALID_INDEX32) { regctx.ClearWatchpointHit(wp_index); thread->SetStoppedByWatchpoint(wp_index); + SetCurrentThreadID(thread->GetID()); SetState(StateType::eStateStopped, true); break; } thread->SetStoppedByTrace(); + SetCurrentThreadID(thread->GetID()); } SetState(StateType::eStateStopped, true); @@ -370,9 +374,10 @@ static_cast<NativeThreadFreeBSD &>(*abs_thread); assert(info.pl_lwpid >= 0); if (info.pl_lwpid == 0 || - static_cast<lldb::tid_t>(info.pl_lwpid) == thread.GetID()) + static_cast<lldb::tid_t>(info.pl_lwpid) == thread.GetID()) { thread.SetStoppedBySignal(info.pl_siginfo.si_signo, &info.pl_siginfo); - else + SetCurrentThreadID(thread.GetID()); + } else thread.SetStoppedWithNoReason(); } SetState(StateType::eStateStopped, true); @@ -809,6 +814,9 @@ break; } } + + if (GetCurrentThreadID() == thread_id) + SetCurrentThreadID(m_threads.front()->GetID()); } Status NativeProcessFreeBSD::Attach() {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits