summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-03-30 10:50:24 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-03-30 10:50:24 +0000
commit058c302e0a868eb666910d46b891004b793cc84d (patch)
tree83311ec296e38d8a29287767ce146365b07eb7aa /lldb/source/API/SBThread.cpp
parent587e1de4ea2af5a01f5d53647201c974a8fea1f2 (diff)
downloadbcm5719-llvm-058c302e0a868eb666910d46b891004b793cc84d.tar.gz
bcm5719-llvm-058c302e0a868eb666910d46b891004b793cc84d.zip
Fix the ThreadSanitizer support to avoid creating empty SBThreads and to not crash when thread_id is unavailable. Plus a whitespace fix.
llvm-svn: 264854
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r--lldb/source/API/SBThread.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index e954781e306..015a42d4eb0 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -338,8 +338,12 @@ AddThreadsForPath(std::string path, ThreadCollectionSP threads, ProcessSP proces
pcs.push_back(pc->GetAsInteger()->GetValue());
return true;
});
+
+ if (pcs.size() == 0)
+ return true;
- tid_t tid = o->GetObjectForDotSeparatedPath("thread_id")->GetIntegerValue();
+ StructuredData::ObjectSP thread_id_obj = o->GetObjectForDotSeparatedPath("thread_id");
+ tid_t tid = thread_id_obj ? thread_id_obj->GetIntegerValue() : 0;
uint32_t stop_id = 0;
bool stop_id_is_valid = false;
HistoryThread *history_thread = new HistoryThread(*process_sp, tid, pcs, stop_id, stop_id_is_valid);
OpenPOWER on IntegriCloud