forked from OSchip/llvm-project
Fix a bunch of thinko's in the command "thread continue".
rdar://problem/11562050 llvm-svn: 157767
This commit is contained in:
parent
cb5d5a571e
commit
ce76c62b08
|
@ -660,11 +660,26 @@ public:
|
|||
std::vector<uint32_t> resume_thread_indexes;
|
||||
for (uint32_t i=0; i<argc; ++i)
|
||||
{
|
||||
idx = Args::StringToUInt32 (command.GetArgumentAtIndex(0), LLDB_INVALID_INDEX32);
|
||||
if (idx < num_threads)
|
||||
resume_thread_indexes.push_back(idx);
|
||||
bool success;
|
||||
const int base = 0;
|
||||
idx = Args::StringToUInt32 (command.GetArgumentAtIndex(i), LLDB_INVALID_INDEX32, base, &success);
|
||||
if (!success)
|
||||
{
|
||||
result.AppendErrorWithFormat ("invalid value for thread index: %s.", command.GetArgumentAtIndex(i));
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
else if (process->GetThreadList().FindThreadByIndexID(idx))
|
||||
{
|
||||
if (find(resume_thread_indexes.begin(), resume_thread_indexes.end(), idx) == resume_thread_indexes.end())
|
||||
resume_thread_indexes.push_back(idx);
|
||||
}
|
||||
else
|
||||
result.AppendWarningWithFormat("Thread index %u out of range.\n", idx);
|
||||
{
|
||||
result.AppendErrorWithFormat("thread index %u out of range.\n", idx);
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (resume_thread_indexes.empty())
|
||||
|
@ -675,13 +690,24 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
result.AppendMessage ("Resuming thread ");
|
||||
if (resume_thread_indexes.size() == 1)
|
||||
result.AppendMessageWithFormat ("Resuming thread: ");
|
||||
else
|
||||
result.AppendMessageWithFormat ("Resuming threads: ");
|
||||
|
||||
for (idx=0; idx<num_threads; ++idx)
|
||||
{
|
||||
Thread *thread = process->GetThreadList().FindThreadByIndexID(idx).get();
|
||||
if (find(resume_thread_indexes.begin(), resume_thread_indexes.end(), idx) != resume_thread_indexes.end())
|
||||
std::vector<uint32_t>::iterator this_thread_pos = find(resume_thread_indexes.begin(), resume_thread_indexes.end(), thread->GetIndexID());
|
||||
|
||||
if (this_thread_pos != resume_thread_indexes.end())
|
||||
{
|
||||
result.AppendMessageWithFormat ("%u ", idx);
|
||||
resume_thread_indexes.erase(this_thread_pos);
|
||||
if (resume_thread_indexes.size() > 0)
|
||||
result.AppendMessageWithFormat ("%u, ", thread->GetIndexID());
|
||||
else
|
||||
result.AppendMessageWithFormat ("%u ", thread->GetIndexID());
|
||||
|
||||
thread->SetResumeState (eStateRunning);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue