[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID
Venkata Ramanaiah Nalamothu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 2 23:44:32 PDT 2022
RamNalamothu updated this revision to Diff 433966.
RamNalamothu added a comment.
Herald added a project: LLDB.
Went ahead and added the error capturing for setting incorrect thread id and also the fix.
Without the following change/fix
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 04457b232f3b..11affe8a7c13 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1095,8 +1095,7 @@ protected:
return false;
}
- if (!process->GetThreadList().SetSelectedThreadByID(
- m_options.m_thread_idx)) {
+ if (!process->GetThreadList().SetSelectedThreadByID(thread->GetID())) {
result.AppendErrorWithFormat(
"Failed to set the selected thread to thread id %" PRIu64 ".\n",
thread->GetID());
the `lldb/test/API/commands/expression/formatters/TestFormatters.py:228: self.runCmd("thread until " + str(ret))` test would fail.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D48865/new/
https://reviews.llvm.org/D48865
Files:
lldb/source/Commands/CommandObjectThread.cpp
Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -984,8 +984,8 @@
thread->GetStackFrameAtIndex(m_options.m_frame_idx).get();
if (frame == nullptr) {
result.AppendErrorWithFormat(
- "Frame index %u is out of range for thread %u.\n",
- m_options.m_frame_idx, m_options.m_thread_idx);
+ "Frame index %u is out of range for thread id %" PRIu64 ".\n",
+ m_options.m_frame_idx, thread->GetID());
return false;
}
@@ -1002,9 +1002,8 @@
if (line_table == nullptr) {
result.AppendErrorWithFormat("Failed to resolve the line table for "
- "frame %u of thread index %u.\n",
- m_options.m_frame_idx,
- m_options.m_thread_idx);
+ "frame %u of thread id %" PRIu64 ".\n",
+ m_options.m_frame_idx, thread->GetID());
return false;
}
@@ -1090,13 +1089,18 @@
return false;
}
} else {
- result.AppendErrorWithFormat(
- "Frame index %u of thread %u has no debug information.\n",
- m_options.m_frame_idx, m_options.m_thread_idx);
+ result.AppendErrorWithFormat("Frame index %u of thread id %" PRIu64
+ " has no debug information.\n",
+ m_options.m_frame_idx, thread->GetID());
return false;
}
- process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx);
+ if (!process->GetThreadList().SetSelectedThreadByID(thread->GetID())) {
+ result.AppendErrorWithFormat(
+ "Failed to set the selected thread to thread id %" PRIu64 ".\n",
+ thread->GetID());
+ return false;
+ }
StreamString stream;
Status error;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48865.433966.patch
Type: text/x-patch
Size: 2107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220603/1d497db2/attachment.bin>
More information about the lldb-commits
mailing list