#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h"
-#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
+#include "Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h"
#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h"
#include "Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h"
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
InstrumentationRuntimeASan::Initialize();
InstrumentationRuntimeTSan::Initialize();
InstrumentationRuntimeUBSan::Initialize();
- MainThreadCheckerRuntime::Initialize();
+ InstrumentationRuntimeMainThreadChecker::Initialize();
SymbolVendorELF::Initialize();
breakpad::SymbolFileBreakpad::Initialize();
InstrumentationRuntimeASan::Terminate();
InstrumentationRuntimeTSan::Terminate();
InstrumentationRuntimeUBSan::Terminate();
- MainThreadCheckerRuntime::Terminate();
+ InstrumentationRuntimeMainThreadChecker::Terminate();
+
wasm::SymbolVendorWasm::Terminate();
SymbolVendorELF::Terminate();
breakpad::SymbolFileBreakpad::Terminate();
add_lldb_library(lldbPluginInstrumentationRuntimeMainThreadChecker PLUGIN
- MainThreadCheckerRuntime.cpp
+ InstrumentationRuntimeMainThreadChecker.cpp
LINK_LIBS
lldbBreakpoint
-//===-- MainThreadCheckerRuntime.cpp ----------------------------*- C++ -*-===//
+//===-- InstrumentationRuntimeMainThreadChecker.cpp -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//
-#include "MainThreadCheckerRuntime.h"
+#include "InstrumentationRuntimeMainThreadChecker.h"
+#include "Plugins/Process/Utility/HistoryThread.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/RegularExpression.h"
-#include "Plugins/Process/Utility/HistoryThread.h"
#include <memory>
using namespace lldb;
using namespace lldb_private;
-MainThreadCheckerRuntime::~MainThreadCheckerRuntime() {
+InstrumentationRuntimeMainThreadChecker::
+ ~InstrumentationRuntimeMainThreadChecker() {
Deactivate();
}
lldb::InstrumentationRuntimeSP
-MainThreadCheckerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) {
- return InstrumentationRuntimeSP(new MainThreadCheckerRuntime(process_sp));
+InstrumentationRuntimeMainThreadChecker::CreateInstance(
+ const lldb::ProcessSP &process_sp) {
+ return InstrumentationRuntimeSP(
+ new InstrumentationRuntimeMainThreadChecker(process_sp));
}
-void MainThreadCheckerRuntime::Initialize() {
+void InstrumentationRuntimeMainThreadChecker::Initialize() {
PluginManager::RegisterPlugin(
- GetPluginNameStatic(), "MainThreadChecker instrumentation runtime plugin.",
- CreateInstance, GetTypeStatic);
+ GetPluginNameStatic(),
+ "MainThreadChecker instrumentation runtime plugin.", CreateInstance,
+ GetTypeStatic);
}
-void MainThreadCheckerRuntime::Terminate() {
+void InstrumentationRuntimeMainThreadChecker::Terminate() {
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString MainThreadCheckerRuntime::GetPluginNameStatic() {
+lldb_private::ConstString
+InstrumentationRuntimeMainThreadChecker::GetPluginNameStatic() {
return ConstString("MainThreadChecker");
}
-lldb::InstrumentationRuntimeType MainThreadCheckerRuntime::GetTypeStatic() {
+lldb::InstrumentationRuntimeType
+InstrumentationRuntimeMainThreadChecker::GetTypeStatic() {
return eInstrumentationRuntimeTypeMainThreadChecker;
}
const RegularExpression &
-MainThreadCheckerRuntime::GetPatternForRuntimeLibrary() {
+InstrumentationRuntimeMainThreadChecker::GetPatternForRuntimeLibrary() {
static RegularExpression regex(llvm::StringRef("libMainThreadChecker.dylib"));
return regex;
}
-bool MainThreadCheckerRuntime::CheckIfRuntimeIsValid(
+bool InstrumentationRuntimeMainThreadChecker::CheckIfRuntimeIsValid(
const lldb::ModuleSP module_sp) {
static ConstString test_sym("__main_thread_checker_on_report");
const Symbol *symbol =
}
StructuredData::ObjectSP
-MainThreadCheckerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) {
+InstrumentationRuntimeMainThreadChecker::RetrieveReportData(
+ ExecutionContextRef exe_ctx_ref) {
ProcessSP process_sp = GetProcessSP();
if (!process_sp)
return StructuredData::ObjectSP();
return dict_sp;
}
-bool MainThreadCheckerRuntime::NotifyBreakpointHit(
+bool InstrumentationRuntimeMainThreadChecker::NotifyBreakpointHit(
void *baton, StoppointCallbackContext *context, user_id_t break_id,
user_id_t break_loc_id) {
assert(baton && "null baton");
if (!baton)
return false; ///< false => resume execution.
- MainThreadCheckerRuntime *const instance =
- static_cast<MainThreadCheckerRuntime *>(baton);
+ InstrumentationRuntimeMainThreadChecker *const instance =
+ static_cast<InstrumentationRuntimeMainThreadChecker *>(baton);
ProcessSP process_sp = instance->GetProcessSP();
ThreadSP thread_sp = context->exe_ctx_ref.GetThreadSP();
if (report) {
std::string description = report->GetAsDictionary()
- ->GetValueForKey("description")
- ->GetAsString()
- ->GetValue();
+ ->GetValueForKey("description")
+ ->GetAsString()
+ ->GetValue();
thread_sp->SetStopInfo(
InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData(
*thread_sp, description, report));
return false;
}
-void MainThreadCheckerRuntime::Activate() {
+void InstrumentationRuntimeMainThreadChecker::Activate() {
if (IsActive())
return;
.CreateBreakpoint(symbol_address, /*internal=*/true,
/*hardware=*/false)
.get();
- breakpoint->SetCallback(MainThreadCheckerRuntime::NotifyBreakpointHit, this,
- true);
+ breakpoint->SetCallback(
+ InstrumentationRuntimeMainThreadChecker::NotifyBreakpointHit, this, true);
breakpoint->SetBreakpointKind("main-thread-checker-report");
SetBreakpointID(breakpoint->GetID());
SetActive(true);
}
-void MainThreadCheckerRuntime::Deactivate() {
+void InstrumentationRuntimeMainThreadChecker::Deactivate() {
SetActive(false);
auto BID = GetBreakpointID();
}
lldb::ThreadCollectionSP
-MainThreadCheckerRuntime::GetBacktracesFromExtendedStopInfo(
+InstrumentationRuntimeMainThreadChecker::GetBacktracesFromExtendedStopInfo(
StructuredData::ObjectSP info) {
ThreadCollectionSP threads;
threads = std::make_shared<ThreadCollection>();
ProcessSP process_sp = GetProcessSP();
if (info->GetObjectForDotSeparatedPath("instrumentation_class")
- ->GetStringValue() != "MainThreadChecker")
+ ->GetStringValue() != "MainThreadChecker")
return threads;
std::vector<lldb::addr_t> PCs;
--- /dev/null
+//===-- InstrumentationRuntimeMainThreadChecker.h----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_MainThreadCheckerRuntime_h_
+#define liblldb_MainThreadCheckerRuntime_h_
+
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class InstrumentationRuntimeMainThreadChecker
+ : public lldb_private::InstrumentationRuntime {
+public:
+ ~InstrumentationRuntimeMainThreadChecker() 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; }
+
+ lldb::ThreadCollectionSP
+ GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
+
+private:
+ InstrumentationRuntimeMainThreadChecker(const lldb::ProcessSP &process_sp)
+ : lldb_private::InstrumentationRuntime(process_sp) {}
+
+ const RegularExpression &GetPatternForRuntimeLibrary() override;
+
+ bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
+
+ void Activate() override;
+
+ 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);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_MainThreadCheckerRuntime_h_
+++ /dev/null
-//===-- MainThreadCheckerRuntime.h ------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_MainThreadCheckerRuntime_h_
-#define liblldb_MainThreadCheckerRuntime_h_
-
-#include "lldb/Target/ABI.h"
-#include "lldb/Target/InstrumentationRuntime.h"
-#include "lldb/Utility/StructuredData.h"
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
- class MainThreadCheckerRuntime : public lldb_private::InstrumentationRuntime {
- public:
- ~MainThreadCheckerRuntime() 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; }
-
- lldb::ThreadCollectionSP
- GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
-
- private:
- MainThreadCheckerRuntime(const lldb::ProcessSP &process_sp)
- : lldb_private::InstrumentationRuntime(process_sp) {}
-
- const RegularExpression &GetPatternForRuntimeLibrary() override;
-
- bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;
-
- void Activate() override;
-
- 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);
- };
-
-} // namespace lldb_private
-
-#endif // liblldb_MainThreadCheckerRuntime_h_
#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h"
-#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
+#include "Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h"
#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h"
#include "Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h"
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
InstrumentationRuntimeASan::Initialize();
InstrumentationRuntimeTSan::Initialize();
InstrumentationRuntimeUBSan::Initialize();
- MainThreadCheckerRuntime::Initialize();
+ InstrumentationRuntimeMainThreadChecker::Initialize();
SymbolVendorELF::Initialize();
breakpad::SymbolFileBreakpad::Initialize();
InstrumentationRuntimeASan::Terminate();
InstrumentationRuntimeTSan::Terminate();
InstrumentationRuntimeUBSan::Terminate();
- MainThreadCheckerRuntime::Terminate();
+ InstrumentationRuntimeMainThreadChecker::Terminate();
+
wasm::SymbolVendorWasm::Terminate();
SymbolVendorELF::Terminate();
breakpad::SymbolFileBreakpad::Terminate();