67 lines · c
1//===-- InstrumentationRuntimeUBSan.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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_UBSAN_INSTRUMENTATIONRUNTIMEUBSAN_H10#define LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_UBSAN_INSTRUMENTATIONRUNTIMEUBSAN_H11 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 19class InstrumentationRuntimeUBSan20 : public lldb_private::InstrumentationRuntime {21public:22 ~InstrumentationRuntimeUBSan() override;23 24 static lldb::InstrumentationRuntimeSP25 CreateInstance(const lldb::ProcessSP &process_sp);26 27 static void Initialize();28 29 static void Terminate();30 31 static llvm::StringRef GetPluginNameStatic() {32 return "UndefinedBehaviorSanitizer";33 }34 35 static lldb::InstrumentationRuntimeType GetTypeStatic();36 37 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }38 39 virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }40 41 lldb::ThreadCollectionSP42 GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;43 44private:45 InstrumentationRuntimeUBSan(const lldb::ProcessSP &process_sp)46 : lldb_private::InstrumentationRuntime(process_sp) {}47 48 const RegularExpression &GetPatternForRuntimeLibrary() override;49 50 bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override;51 52 void Activate() override;53 54 void Deactivate();55 56 static bool NotifyBreakpointHit(void *baton,57 StoppointCallbackContext *context,58 lldb::user_id_t break_id,59 lldb::user_id_t break_loc_id);60 61 StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref);62};63 64} // namespace lldb_private65 66#endif // LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_UBSAN_INSTRUMENTATIONRUNTIMEUBSAN_H67