[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)
Michael Christensen via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 29 10:36:14 PST 2023
================
@@ -807,6 +808,23 @@ void CommandCompletions::TypeCategoryNames(CommandInterpreter &interpreter,
});
}
+void CommandCompletions::ThreadIDs(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher) {
+ const ExecutionContext &exe_ctx = interpreter.GetExecutionContext();
+ if (!exe_ctx.HasProcessScope())
+ return;
+
+ ThreadList &threads = exe_ctx.GetProcessPtr()->GetThreadList();
+ lldb::ThreadSP thread_sp;
+ for (uint32_t idx = 0; (thread_sp = threads.GetThreadAtIndex(idx)); ++idx) {
----------------
mdko wrote:
It's to avoid this warning:
```
/home/michristensen/llvm/llvm-project/lldb/source/Commands/CommandCompletions.cpp:820:36: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
for (uint32_t idx = 0; thread_sp = threads.GetThreadAtIndex(idx); ++idx) {
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/michristensen/llvm/llvm-project/lldb/source/Commands/CommandCompletions.cpp:820:36: note: place parentheses around the assignment to silence this warning
for (uint32_t idx = 0; thread_sp = threads.GetThreadAtIndex(idx); ++idx) {
```
It's also consistent to how it was done in the ThreadIndex completer code:
https://github.com/llvm/llvm-project/blob/e109a2ea37b20141aad8c4db4d39ff56e8a6dc4e/lldb/source/Commands/CommandCompletions.cpp#L776
https://github.com/llvm/llvm-project/pull/73596
More information about the lldb-commits
mailing list