[Lldb-commits] [lldb] [LLDB][Accelerators][1/M] Scaffold a basic Mock plugin for testing accelerator flows (PR #186535)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 20 14:00:09 PDT 2026
================
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "LLDBServerPluginMockAccelerator.h"
+
+#include "llvm/Support/Process.h"
+
+using namespace lldb_private::lldb_server;
+
+LLDBServerPluginMockAccelerator::LLDBServerPluginMockAccelerator(
+ GDBServer &gdb_server, MainLoop &main_loop)
+ : LLDBServerPluginAccelerator(gdb_server, main_loop) {}
+
+llvm::StringRef LLDBServerPluginMockAccelerator::GetPluginName() {
+ return "mock-accelerator";
+}
+
+bool LLDBServerPluginMockAccelerator::TryActivate() {
+ // Check if the plugin should be enabled
+ std::optional<std::string> val = llvm::sys::Process::GetEnv(kEnableEnvVar);
+ if (!val || val->empty())
+ return false;
+
+ // Activate the plugin by writing the parent PID to the test file
+ std::error_code ec;
+ llvm::raw_fd_ostream out("/tmp/accelerator_plugin_test.txt", ec,
----------------
clayborg wrote:
Grab this path from an environment variable (`MOCK_PLUGIN_OUTPUT_PATH`) as mentioned above?
https://github.com/llvm/llvm-project/pull/186535
More information about the lldb-commits
mailing list