diff options
author | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2025-02-28 16:13:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-28 16:13:12 -0800 |
commit | 11b9466c04db4da7439fc1d9d8ba7241a9d68705 (patch) | |
tree | 76836aa31c460fc7ba8545be08a838f01fcb1737 /lldb/source/Commands/CommandObjectThread.cpp | |
parent | 45d018097c8e92f1978478382426c683b19be88f (diff) | |
download | llvm-11b9466c04db4da7439fc1d9d8ba7241a9d68705.zip llvm-11b9466c04db4da7439fc1d9d8ba7241a9d68705.tar.gz llvm-11b9466c04db4da7439fc1d9d8ba7241a9d68705.tar.bz2 |
[lldb] Add ability to inspect backing threads with `thread info` (#129275)
When OS plugins are present, it can be helpful to query information
about the backing thread behind an OS thread, if it exists. There is no
mechanism to do so prior to this commit.
As a first step, this commit enhances `thread info` with a
`--backing-thread` flag, causing the command to use the backing thread
of the selected thread, if it exists.
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index cd3d2d8..224c523 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1270,6 +1270,7 @@ public: void OptionParsingStarting(ExecutionContext *execution_context) override { m_json_thread = false; m_json_stopinfo = false; + m_backing_thread = false; } Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, @@ -1286,6 +1287,10 @@ public: m_json_stopinfo = true; break; + case 'b': + m_backing_thread = true; + break; + default: llvm_unreachable("Unimplemented option"); } @@ -1298,6 +1303,7 @@ public: bool m_json_thread; bool m_json_stopinfo; + bool m_backing_thread; }; CommandObjectThreadInfo(CommandInterpreter &interpreter) @@ -1334,6 +1340,8 @@ public: } Thread *thread = thread_sp.get(); + if (m_options.m_backing_thread && thread->GetBackingThread()) + thread = thread->GetBackingThread().get(); Stream &strm = result.GetOutputStream(); if (!thread->GetDescription(strm, eDescriptionLevelFull, |