1 //===-- MainThreadCheckerRuntime.h ------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_MainThreadCheckerRuntime_h_ 11 #define liblldb_MainThreadCheckerRuntime_h_ 12 13 #include "lldb/Target/ABI.h" 14 #include "lldb/Target/InstrumentationRuntime.h" 15 #include "lldb/Utility/StructuredData.h" 16 #include "lldb/lldb-private.h" 17 18 namespace lldb_private { 19 20 class MainThreadCheckerRuntime : public lldb_private::InstrumentationRuntime { 21 public: 22 ~MainThreadCheckerRuntime() 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: MainThreadCheckerRuntime(const lldb::ProcessSP & process_sp)47 MainThreadCheckerRuntime(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 // liblldb_MainThreadCheckerRuntime_h_ 69