diff options
Diffstat (limited to 'lldb/source/Plugins/InstrumentationRuntime/ASan')
| -rw-r--r-- | lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp (renamed from lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp) | 48 | ||||
| -rw-r--r-- | lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h (renamed from lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h) | 14 | 
2 files changed, 32 insertions, 30 deletions
| diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp index 2e5dd5989e774..e78ea3a684836 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp @@ -1,4 +1,4 @@ -//===-- ASanRuntime.cpp -----------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeASan.cpp ------------------------------------===//  //  // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.  // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@  //  //===----------------------------------------------------------------------===// -#include "ASanRuntime.h" +#include "InstrumentationRuntimeASan.h"  #include "lldb/Breakpoint/StoppointCallbackContext.h"  #include "lldb/Core/Debugger.h" @@ -30,40 +30,42 @@  using namespace lldb;  using namespace lldb_private; +LLDB_PLUGIN_DEFINE(InstrumentationRuntimeASan) +  lldb::InstrumentationRuntimeSP -AddressSanitizerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) { -  return InstrumentationRuntimeSP(new AddressSanitizerRuntime(process_sp)); +InstrumentationRuntimeASan::CreateInstance(const lldb::ProcessSP &process_sp) { +  return InstrumentationRuntimeSP(new InstrumentationRuntimeASan(process_sp));  } -void AddressSanitizerRuntime::Initialize() { +void InstrumentationRuntimeASan::Initialize() {    PluginManager::RegisterPlugin(        GetPluginNameStatic(), "AddressSanitizer instrumentation runtime plugin.",        CreateInstance, GetTypeStatic);  } -void AddressSanitizerRuntime::Terminate() { +void InstrumentationRuntimeASan::Terminate() {    PluginManager::UnregisterPlugin(CreateInstance);  } -lldb_private::ConstString AddressSanitizerRuntime::GetPluginNameStatic() { +lldb_private::ConstString InstrumentationRuntimeASan::GetPluginNameStatic() {    return ConstString("AddressSanitizer");  } -lldb::InstrumentationRuntimeType AddressSanitizerRuntime::GetTypeStatic() { +lldb::InstrumentationRuntimeType InstrumentationRuntimeASan::GetTypeStatic() {    return eInstrumentationRuntimeTypeAddressSanitizer;  } -AddressSanitizerRuntime::~AddressSanitizerRuntime() { Deactivate(); } +InstrumentationRuntimeASan::~InstrumentationRuntimeASan() { Deactivate(); }  const RegularExpression & -AddressSanitizerRuntime::GetPatternForRuntimeLibrary() { +InstrumentationRuntimeASan::GetPatternForRuntimeLibrary() {    // FIXME: This shouldn't include the "dylib" suffix.    static RegularExpression regex(        llvm::StringRef("libclang_rt.asan_(.*)_dynamic\\.dylib"));    return regex;  } -bool AddressSanitizerRuntime::CheckIfRuntimeIsValid( +bool InstrumentationRuntimeASan::CheckIfRuntimeIsValid(      const lldb::ModuleSP module_sp) {    const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(        ConstString("__asan_get_alloc_stack"), lldb::eSymbolTypeAny); @@ -108,7 +110,7 @@ t.description = __asan_get_report_description();  t  )"; -StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() { +StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() {    ProcessSP process_sp = GetProcessSP();    if (!process_sp)      return StructuredData::ObjectSP(); @@ -189,11 +191,11 @@ StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() {  }  std::string -AddressSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) { -  std::string description = report->GetAsDictionary() -                                ->GetValueForKey("description") -                                ->GetAsString() -                                ->GetValue(); +InstrumentationRuntimeASan::FormatDescription(StructuredData::ObjectSP report) { +  std::string description = std::string(report->GetAsDictionary() +                                            ->GetValueForKey("description") +                                            ->GetAsString() +                                            ->GetValue());    return llvm::StringSwitch<std::string>(description)        .Case("heap-use-after-free", "Use of deallocated memory")        .Case("heap-buffer-overflow", "Heap buffer overflow") @@ -235,15 +237,15 @@ AddressSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) {        .Default("AddressSanitizer detected: " + description);  } -bool AddressSanitizerRuntime::NotifyBreakpointHit( +bool InstrumentationRuntimeASan::NotifyBreakpointHit(      void *baton, StoppointCallbackContext *context, user_id_t break_id,      user_id_t break_loc_id) {    assert(baton && "null baton");    if (!baton)      return false; -  AddressSanitizerRuntime *const instance = -      static_cast<AddressSanitizerRuntime *>(baton); +  InstrumentationRuntimeASan *const instance = +      static_cast<InstrumentationRuntimeASan *>(baton);    ProcessSP process_sp = instance->GetProcessSP(); @@ -275,7 +277,7 @@ bool AddressSanitizerRuntime::NotifyBreakpointHit(      return false; // Let target run  } -void AddressSanitizerRuntime::Activate() { +void InstrumentationRuntimeASan::Activate() {    if (IsActive())      return; @@ -305,7 +307,7 @@ void AddressSanitizerRuntime::Activate() {        process_sp->GetTarget()            .CreateBreakpoint(symbol_address, internal, hardware)            .get(); -  breakpoint->SetCallback(AddressSanitizerRuntime::NotifyBreakpointHit, this, +  breakpoint->SetCallback(InstrumentationRuntimeASan::NotifyBreakpointHit, this,                            true);    breakpoint->SetBreakpointKind("address-sanitizer-report");    SetBreakpointID(breakpoint->GetID()); @@ -313,7 +315,7 @@ void AddressSanitizerRuntime::Activate() {    SetActive(true);  } -void AddressSanitizerRuntime::Deactivate() { +void InstrumentationRuntimeASan::Deactivate() {    if (GetBreakpointID() != LLDB_INVALID_BREAK_ID) {      ProcessSP process_sp = GetProcessSP();      if (process_sp) { diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h index 0771e624ff6b8..cde0a96133500 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h @@ -1,4 +1,4 @@ -//===-- ASanRuntime.h -------------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeASan.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. @@ -6,8 +6,8 @@  //  //===----------------------------------------------------------------------===// -#ifndef liblldb_AddressSanitizerRuntime_h_ -#define liblldb_AddressSanitizerRuntime_h_ +#ifndef LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_ASAN_INSTRUMENTATIONRUNTIMEASAN_H +#define LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_ASAN_INSTRUMENTATIONRUNTIMEASAN_H  #include "lldb/Target/InstrumentationRuntime.h"  #include "lldb/Target/Process.h" @@ -16,9 +16,9 @@  namespace lldb_private { -class AddressSanitizerRuntime : public lldb_private::InstrumentationRuntime { +class InstrumentationRuntimeASan : public lldb_private::InstrumentationRuntime {  public: -  ~AddressSanitizerRuntime() override; +  ~InstrumentationRuntimeASan() override;    static lldb::InstrumentationRuntimeSP    CreateInstance(const lldb::ProcessSP &process_sp); @@ -40,7 +40,7 @@ public:    uint32_t GetPluginVersion() override { return 1; }  private: -  AddressSanitizerRuntime(const lldb::ProcessSP &process_sp) +  InstrumentationRuntimeASan(const lldb::ProcessSP &process_sp)        : lldb_private::InstrumentationRuntime(process_sp) {}    const RegularExpression &GetPatternForRuntimeLibrary() override; @@ -63,4 +63,4 @@ private:  } // namespace lldb_private -#endif // liblldb_AddressSanitizerRuntime_h_ +#endif // LLDB_SOURCE_PLUGINS_INSTRUMENTATIONRUNTIME_ASAN_INSTRUMENTATIONRUNTIMEASAN_H | 
