Skip to content

Commit ac17112

Browse files
[lldb] Add OS plugin property for reporting all threads
Currently, an LLDB target option controls whether plugins report all threads. However, it seems natural for this knowledge could come from the plugin itself. To support this, this commits adds a virtual method to the plugin base class, making the Python OS query the target option to preserve existing behavior.
1 parent dac06e7 commit ac17112

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

lldb/include/lldb/Target/OperatingSystem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class OperatingSystem : public PluginInterface {
6161

6262
virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
6363

64+
virtual bool DoesPluginReportAllThreads() = 0;
65+
6466
protected:
6567
// Member variables.
6668
Process

lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,8 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
386386
return ThreadSP();
387387
}
388388

389+
bool OperatingSystemPython::DoesPluginReportAllThreads() {
390+
return m_process->GetOSPluginReportsAllThreads();
391+
}
392+
389393
#endif // #if LLDB_ENABLE_PYTHON

lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class OperatingSystemPython : public lldb_private::OperatingSystem {
6060
// Method for lazy creation of threads on demand
6161
lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
6262

63+
bool DoesPluginReportAllThreads() override;
64+
6365
protected:
6466
bool IsValid() const {
6567
return m_script_object_sp && m_script_object_sp->IsValid();

lldb/source/Target/Process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ void Process::UpdateThreadListIfNeeded() {
11821182
// See if the OS plugin reports all threads. If it does, then
11831183
// it is safe to clear unseen thread's plans here. Otherwise we
11841184
// should preserve them in case they show up again:
1185-
clear_unused_threads = GetOSPluginReportsAllThreads();
1185+
clear_unused_threads = os->DoesPluginReportAllThreads();
11861186

11871187
// Turn off dynamic types to ensure we don't run any expressions.
11881188
// Objective-C can run an expression to determine if a SBValue is a

lldb/source/Target/TargetProperties.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ let Definition = "process_experimental" in {
223223
def OSPluginReportsAllThreads: Property<"os-plugin-reports-all-threads", "Boolean">,
224224
Global,
225225
DefaultTrue,
226-
Desc<"Set to False if your OS Plugins doesn't report all threads on each stop.">;
226+
Desc<"Set to False if your Python OS Plugin doesn't report all threads on each stop.">;
227227
}
228228

229229
let Definition = "process" in {

0 commit comments

Comments
 (0)