1 //===-- InstrumentationRuntimeMainThreadChecker.h----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_MAINTHREADCHECKER_INSTRUMENTATIONRUNTIMEMAINTHREADCHECKER_H 10 #define LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_MAINTHREADCHECKER_INSTRUMENTATIONRUNTIMEMAINTHREADCHECKER_H 11 12 #include "lldb/Target/ABI.h" 13 #include "lldb/Target/InstrumentationRuntime.h" 14 #include "lldb/Utility/StructuredData.h" 15 #include "lldb/lldb-private.h" 16 17 namespace lldb_private { 18 19 class InstrumentationRuntimeMainThreadChecker 20 : public lldb_private::InstrumentationRuntime { 21 public: 22 ~InstrumentationRuntimeMainThreadChecker() override; 23 24 static lldb::InstrumentationRuntimeSP 25 CreateInstance(const lldb::ProcessSP &process_sp); 26 27 static void Initialize(); 28 29 static void Terminate(); 30 31 static lldb_private::ConstString GetPluginNameStatic(); 32 33 static lldb::InstrumentationRuntimeType GetTypeStatic(); 34 GetPluginName()35 lldb_private::ConstString GetPluginName() override { 36 return GetPluginNameStatic(); 37 } 38 GetType()39 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } 40 GetPluginVersion()41 uint32_t GetPluginVersion() override { return 1; } 42 43 lldb::ThreadCollectionSP 44 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; 45 46 private: InstrumentationRuntimeMainThreadChecker(const lldb::ProcessSP & process_sp)47 InstrumentationRuntimeMainThreadChecker(const lldb::ProcessSP &process_sp) 48 : lldb_private::InstrumentationRuntime(process_sp) {} 49 50 const RegularExpression &GetPatternForRuntimeLibrary() override; 51 52 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; 53 54 void Activate() override; 55 56 void Deactivate(); 57 58 static bool NotifyBreakpointHit(void *baton, 59 StoppointCallbackContext *context, 60 lldb::user_id_t break_id, 61 lldb::user_id_t break_loc_id); 62 63 StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref); 64 }; 65 66 } // namespace lldb_private 67 68 #endif // LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_MAINTHREADCHECKER_INSTRUMENTATIONRUNTIMEMAINTHREADCHECKER_H 69