[Lldb-commits] [PATCH] D117076: [lldb/Plugins] Fix ScriptedThread IndexID reporting
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 11 19:06:47 PST 2022
mib created this revision.
mib added a reviewer: JDevlieghere.
mib added a project: LLDB.
Herald added a subscriber: arphaman.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
When listing all the Scripted Threads of a ScriptedProcess, we can see that all
have the thread index set to 1. This is caused by the lldb_private::Thread
constructor, which sets the m_index_id member using the provided thread id `tid`.
Because the call to the super constructor is done before instanciating
the `ScriptedThreadInterface`, lldb can't fetch the thread id from the
script instance, so it uses `LLDB_INVALID_THREAD_ID` instead.
To mitigate this, this patch drops the `const` qualifier for the
`m_index_id` Thread member, so it can be set later in the ScriptedThread
constructor body. Dropping the `const` qualifier in this case shouldn't
be too problematic, since `m_index_id` doesn't have any getter and can
only be modified by a derived class (`ScriptedThread` in this case).
rdar://87432065
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117076
Files:
lldb/include/lldb/Target/Thread.h
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
===================================================================
--- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -75,6 +75,8 @@
lldb::tid_t tid = scripted_thread_interface->GetThreadID();
SetID(tid);
+ process.AssignIndexIDToThread(tid);
+ m_index_id = process.GetNextThreadIndexID(tid);
}
ScriptedThread::~ScriptedThread() { DestroyThread(); }
Index: lldb/include/lldb/Target/Thread.h
===================================================================
--- lldb/include/lldb/Target/Thread.h
+++ lldb/include/lldb/Target/Thread.h
@@ -1243,8 +1243,8 @@
uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time
// the stop info was checked against
// the stop info override
- const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread
- ///for easy UI/command line access.
+ uint32_t m_index_id; ///< A unique 1 based index assigned to each thread
+ /// for easy UI/command line access.
lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this
///thread's current register state.
lldb::StateType m_state; ///< The state of our process.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117076.399170.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220112/901d876f/attachment.bin>
More information about the lldb-commits
mailing list