[LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID

For the 'thread until' command, the selected thread ID, to perform the operation on, could be of the current thread or the specified thread.

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D48865
This commit is contained in:
Venkata Ramanaiah Nalamothu 2022-06-15 08:04:32 +05:30
parent 06c6758a98
commit ab7fcf2484
1 changed files with 13 additions and 9 deletions

View File

@ -984,8 +984,8 @@ protected:
thread->GetStackFrameAtIndex(m_options.m_frame_idx).get(); thread->GetStackFrameAtIndex(m_options.m_frame_idx).get();
if (frame == nullptr) { if (frame == nullptr) {
result.AppendErrorWithFormat( result.AppendErrorWithFormat(
"Frame index %u is out of range for thread %u.\n", "Frame index %u is out of range for thread id %" PRIu64 ".\n",
m_options.m_frame_idx, m_options.m_thread_idx); m_options.m_frame_idx, thread->GetID());
return false; return false;
} }
@ -1002,9 +1002,8 @@ protected:
if (line_table == nullptr) { if (line_table == nullptr) {
result.AppendErrorWithFormat("Failed to resolve the line table for " result.AppendErrorWithFormat("Failed to resolve the line table for "
"frame %u of thread index %u.\n", "frame %u of thread id %" PRIu64 ".\n",
m_options.m_frame_idx, m_options.m_frame_idx, thread->GetID());
m_options.m_thread_idx);
return false; return false;
} }
@ -1090,13 +1089,18 @@ protected:
return false; return false;
} }
} else { } else {
result.AppendErrorWithFormat( result.AppendErrorWithFormat("Frame index %u of thread id %" PRIu64
"Frame index %u of thread %u has no debug information.\n", " has no debug information.\n",
m_options.m_frame_idx, m_options.m_thread_idx); m_options.m_frame_idx, thread->GetID());
return false; 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; StreamString stream;
Status error; Status error;