[lldb] Add APIs enabling OperatingSystem plugins to update ThreadPlanStack #122966
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the end of Process::UpdateThreadListIfNeeded, we see this comment:
In other words, if a OS plugin maps a real thread to a plugin thread, the plugin is expected to remove the thread plan of the real thread from
m_thread_plans
.However, it is impossible to do so today: the APIs are simply not there. In fact, plugins don't even have access to
m_thread_plans
. This is not a problem for plugins who "report all threads", since LLDB will then clean up plans for any threads that are not present in the new list of threads (mapped real threads won't be in the new list). For plugins that do not report all threads, this is a problem.There are two pieces missing here:
A) The
OperatingSystem::UpdateThreadList
function needs access to m_thread_plans.B) ThreadPlanStack needs to expose the TIDs it currently knows about, since its methods (like Find, Erase) are all TID-based.
This commit provides these pieces so that future commits (and plugins) may make use of them.
Point A is currently addressed by passing m_thread_plans as a function argument to OperatingSystem::UpdateThreadList, however it would have been possible to make it public through an accessor method in Process.