summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-03-23 15:36:22 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-03-23 15:36:22 +0000
commit6a83143650aeb02e9c53bd5f7b7b5253a6c8b157 (patch)
tree84b85e5d71064a4c24d0100811f7114f2143ab2f /lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
parentd68ed85401a5b1d40fb6065bcbd363e1bd78402d (diff)
downloadbcm5719-llvm-6a83143650aeb02e9c53bd5f7b7b5253a6c8b157.tar.gz
bcm5719-llvm-6a83143650aeb02e9c53bd5f7b7b5253a6c8b157.zip
Add ThreadSanitizer debugging support.
This patch adds ThreadSanitizer support into LLDB: - Adding a new InstrumentationRuntime plugin, ThreadSanitizerRuntime, in the same way ASan is implemented. - A breakpoint stops in `__tsan_on_report`, then we extract all sorts of information by evaluating an expression. We then populate this into StopReasonExtendedInfo. - SBThread gets a new API, SBThread::GetStopReasonExtendedBacktraces(), which returns TSan’s backtraces in the form of regular SBThreads. Non-TSan stop reasons return an empty collection. - Added some test cases. Reviewed by Greg Clayton. llvm-svn: 264162
Diffstat (limited to 'lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h')
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
new file mode 100644
index 00000000000..922d4292af0
--- /dev/null
+++ b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
@@ -0,0 +1,104 @@
+//===-- ThreadSanitizerRuntime.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSanitizerRuntime_h_
+#define liblldb_ThreadSanitizerRuntime_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Core/StructuredData.h"
+
+namespace lldb_private {
+
+class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime
+{
+public:
+ ~ThreadSanitizerRuntime() override;
+
+ static lldb::InstrumentationRuntimeSP
+ CreateInstance (const lldb::ProcessSP &process_sp);
+
+ static void
+ Initialize();
+
+ static void
+ Terminate();
+
+ static lldb_private::ConstString
+ GetPluginNameStatic();
+
+ static lldb::InstrumentationRuntimeType
+ GetTypeStatic();
+
+ lldb_private::ConstString
+ GetPluginName() override
+ {
+ return GetPluginNameStatic();
+ }
+
+ virtual lldb::InstrumentationRuntimeType
+ GetType() { return GetTypeStatic(); }
+
+ uint32_t
+ GetPluginVersion() override
+ {
+ return 1;
+ }
+
+ void
+ ModulesDidLoad(lldb_private::ModuleList &module_list) override;
+
+ bool
+ IsActive() override;
+
+private:
+ ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp);
+
+ lldb::ProcessSP
+ GetProcessSP ()
+ {
+ return m_process_wp.lock();
+ }
+
+ lldb::ModuleSP
+ GetRuntimeModuleSP ()
+ {
+ return m_runtime_module_wp.lock();
+ }
+
+ void
+ Activate();
+
+ void
+ Deactivate();
+
+ static bool
+ NotifyBreakpointHit(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+
+ StructuredData::ObjectSP
+ RetrieveReportData(ExecutionContextRef exe_ctx_ref);
+
+ std::string
+ FormatDescription(StructuredData::ObjectSP report);
+
+ bool m_is_active;
+ lldb::ModuleWP m_runtime_module_wp;
+ lldb::ProcessWP m_process_wp;
+ lldb::user_id_t m_breakpoint_id;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSanitizerRuntime_h_
OpenPOWER on IntegriCloud