[Lldb-commits] [lldb] [lldb] Refactor InstrumentationRuntimeAsan and add a new plugin (PR #69388)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 18 08:56:49 PDT 2023


================
@@ -0,0 +1,108 @@
+//===-- InstrumentationRuntimeLibsanitizers.cpp ------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "InstrumentationRuntimeLibsanitizers.h"
+
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Symbol/Symbol.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/RegularExpression.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE(InstrumentationRuntimeLibsanitizers)
+
+lldb::InstrumentationRuntimeSP
+InstrumentationRuntimeLibsanitizers::CreateInstance(const lldb::ProcessSP &process_sp) {
+  return InstrumentationRuntimeSP(new InstrumentationRuntimeLibsanitizers(process_sp));
+}
+
+void InstrumentationRuntimeLibsanitizers::Initialize() {
+  PluginManager::RegisterPlugin(
+      GetPluginNameStatic(), "AddressSanitizer instrumentation runtime plugin for Libsanitizers.",
+      CreateInstance, GetTypeStatic);
+}
+
+void InstrumentationRuntimeLibsanitizers::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb::InstrumentationRuntimeType InstrumentationRuntimeLibsanitizers::GetTypeStatic() {
+  return eInstrumentationRuntimeTypeLibsanitizersAsan;
+}
+
+InstrumentationRuntimeLibsanitizers::~InstrumentationRuntimeLibsanitizers() { Deactivate(); }
+
+const RegularExpression &
+InstrumentationRuntimeLibsanitizers::GetPatternForRuntimeLibrary() {
+  // FIXME: This shouldn't include the "dylib" suffix.
----------------
bulbazord wrote:

Why shouldn't this include the dylib? The FIXME is pretty clear about what should change but not why. Please add some more detail.

https://github.com/llvm/llvm-project/pull/69388


More information about the lldb-commits mailing list