Repository navigation
[lldb] Add APIs enabling OperatingSystem plugins to update ThreadPlanStack - #122966
Closed
felipepiovezan wants to merge 1 commit into
Closed
felipepiovezan wants to merge 1 commit into
felipepiovezan wants to merge 1 commit into
Conversation
…Stack
At the end of Process::UpdateThreadListIfNeeded, we see this comment:
```
// Now update the plan stack map.
// If we do have an OS plugin, any absent real threads in the
// m_thread_list have already been removed from the ThreadPlanStackMap.
// So any remaining threads are OS Plugin threads, and those we want to
// preserve in case they show up again.
m_thread_plans.Update(m_thread_list, clear_unused_threads);
```
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.
felipepiovezan
force-pushed
the
felipe/operating-system-stack-api
branch
from
January 14, 2025 21:04
8dc10cc to
c8e7e22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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::UpdateThreadListfunction 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.