1//===-- MainThreadCheckerRuntime.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 liblldb_MainThreadCheckerRuntime_h_ 10#define liblldb_MainThreadCheckerRuntime_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 17namespace lldb_private { 18 19 class MainThreadCheckerRuntime : public lldb_private::InstrumentationRuntime { 20 public: 21 ~MainThreadCheckerRuntime() override; 22 23 static lldb::InstrumentationRuntimeSP 24 CreateInstance(const lldb::ProcessSP &process_sp); 25 26 static void Initialize(); 27 28 static void Terminate(); 29 30 static lldb_private::ConstString GetPluginNameStatic(); 31 32 static lldb::InstrumentationRuntimeType GetTypeStatic(); 33 34 lldb_private::ConstString GetPluginName() override { 35 return GetPluginNameStatic(); 36 } 37 38 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } 39 40 uint32_t GetPluginVersion() override { return 1; } 41 42 lldb::ThreadCollectionSP 43 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; 44 45 private: 46 MainThreadCheckerRuntime(const lldb::ProcessSP &process_sp) 47 : lldb_private::InstrumentationRuntime(process_sp) {} 48 49 const RegularExpression &GetPatternForRuntimeLibrary() override; 50 51 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; 52 53 void Activate() override; 54 55 void Deactivate(); 56 57 static bool NotifyBreakpointHit(void *baton, 58 StoppointCallbackContext *context, 59 lldb::user_id_t break_id, 60 lldb::user_id_t break_loc_id); 61 62 StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref); 63 }; 64 65} // namespace lldb_private 66 67#endif // liblldb_MainThreadCheckerRuntime_h_ 68