summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-04-10 18:57:38 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-04-10 18:57:38 +0000
commit1aad8fb7720a21e22836d153a3a86eaa67242174 (patch)
tree3013bbc0e3f7fe6aa7ba9046c2eef953af535125 /lldb/source/API/SBThread.cpp
parent8d16199b7b0247cf3047dc294ae5e180b72ac5fd (diff)
downloadbcm5719-llvm-1aad8fb7720a21e22836d153a3a86eaa67242174.tar.gz
bcm5719-llvm-1aad8fb7720a21e22836d153a3a86eaa67242174.zip
Provide more information in ThreadSanitizer's JSON data. Move remaining TSan logic from SBThread to InstrumentationRuntime plugin.
llvm-svn: 265905
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r--lldb/source/API/SBThread.cpp43
1 files changed, 3 insertions, 40 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 015a42d4eb0..43fb96d6677 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -34,7 +34,6 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepRange.h"
#include "lldb/Target/ThreadPlanStepInRange.h"
-#include "Plugins/Process/Utility/HistoryThread.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
@@ -329,33 +328,6 @@ SBThread::GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
return true;
}
-static void
-AddThreadsForPath(std::string path, ThreadCollectionSP threads, ProcessSP process_sp, StructuredData::ObjectSP info)
-{
- info->GetObjectForDotSeparatedPath(path)->GetAsArray()->ForEach([process_sp, threads] (StructuredData::Object *o) -> bool {
- std::vector<lldb::addr_t> pcs;
- o->GetObjectForDotSeparatedPath("trace")->GetAsArray()->ForEach([&pcs] (StructuredData::Object *pc) -> bool {
- pcs.push_back(pc->GetAsInteger()->GetValue());
- return true;
- });
-
- if (pcs.size() == 0)
- return true;
-
- 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);
- ThreadSP new_thread_sp(history_thread);
- // Save this in the Process' ExtendedThreadList so a strong pointer retains the object
- process_sp->GetExtendedThreadList().AddThread(new_thread_sp);
- threads->AddThread(new_thread_sp);
-
- return true;
- });
-}
-
SBThreadCollection
SBThread::GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
{
@@ -365,10 +337,10 @@ SBThread::GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
// We currently only support ThreadSanitizer.
if (type != eInstrumentationRuntimeTypeThreadSanitizer)
return threads;
-
+
ExecutionContext exe_ctx (m_opaque_sp.get());
if (! exe_ctx.HasThreadScope())
- return SBThreadCollection(threads);
+ return threads;
ProcessSP process_sp = exe_ctx.GetProcessSP();
@@ -377,16 +349,7 @@ SBThread::GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
if (! info)
return threads;
- if (info->GetObjectForDotSeparatedPath("instrumentation_class")->GetStringValue() != "ThreadSanitizer")
- return threads;
-
- AddThreadsForPath("stacks", threads, process_sp, info);
- AddThreadsForPath("mops", threads, process_sp, info);
- AddThreadsForPath("locs", threads, process_sp, info);
- AddThreadsForPath("mutexes", threads, process_sp, info);
- AddThreadsForPath("threads", threads, process_sp, info);
-
- return threads;
+ return process_sp->GetInstrumentationRuntime(type)->GetBacktracesFromExtendedStopInfo(info);
}
size_t
OpenPOWER on IntegriCloud