This revision was automatically updated to reflect the committed changes. Closed by commit rG8e6bcbb41758: [lldb] [Process/FreeBSDRemote] Fix attaching via lldb-server (authored by mgorny). Herald added a project: LLDB.
Changed prior to commit: https://reviews.llvm.org/D90525?vs=302076&id=302493#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90525/new/ https://reviews.llvm.org/D90525 Files: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -1728,6 +1728,7 @@ case eStateSuspended: case eStateStopped: case eStateCrashed: { + assert(m_debugged_process_up != nullptr); lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID(); // Make sure we set the current thread so g and p packets return the data // the gdb will expect. Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp +++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp @@ -698,8 +698,9 @@ 0) return Status(errno, eErrorTypePOSIX); - /* Initialize threads */ - status = ReinitializeThreads(); + // Initialize threads and tracing status + // NB: this needs to be called before we set thread state + status = SetupTrace(); if (status.Fail()) return status; @@ -707,7 +708,8 @@ static_cast<NativeThreadFreeBSD &>(*thread).SetStoppedBySignal(SIGSTOP); // Let our process instance know the thread has stopped. - SetState(StateType::eStateStopped); + SetCurrentThreadID(m_threads.front()->GetID()); + SetState(StateType::eStateStopped, false); return Status(); }
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -1728,6 +1728,7 @@ case eStateSuspended: case eStateStopped: case eStateCrashed: { + assert(m_debugged_process_up != nullptr); lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID(); // Make sure we set the current thread so g and p packets return the data // the gdb will expect. Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp +++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp @@ -698,8 +698,9 @@ 0) return Status(errno, eErrorTypePOSIX); - /* Initialize threads */ - status = ReinitializeThreads(); + // Initialize threads and tracing status + // NB: this needs to be called before we set thread state + status = SetupTrace(); if (status.Fail()) return status; @@ -707,7 +708,8 @@ static_cast<NativeThreadFreeBSD &>(*thread).SetStoppedBySignal(SIGSTOP); // Let our process instance know the thread has stopped. - SetState(StateType::eStateStopped); + SetCurrentThreadID(m_threads.front()->GetID()); + SetState(StateType::eStateStopped, false); return Status(); }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits