[Lldb-commits] [lldb] [lldb-dap] Send a 'process' event on restart. (PR #163833)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 16 10:52:54 PDT 2025
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/163833
When we restart a process, send an updated 'process' event describing the newly launched process.
I also updated the `isLocalProcess` value based on if we're on the 'host' platform or not.
>From 49e0b3b886f68c60dbfb737688ae4959d69df130 Mon Sep 17 00:00:00 2001
From: John Harrison <harjohn at google.com>
Date: Thu, 16 Oct 2025 10:34:48 -0700
Subject: [PATCH] [lldb-dap] Send a 'process' event on restart.
When we restart a process, send an updated 'process' event describing the newly launched process.
---
lldb/tools/lldb-dap/EventHelper.cpp | 5 ++++-
lldb/tools/lldb-dap/Handler/RestartRequestHandler.cpp | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lldb/tools/lldb-dap/EventHelper.cpp b/lldb/tools/lldb-dap/EventHelper.cpp
index 2b9ed229405a8..ebddb4ec1f502 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -15,6 +15,7 @@
#include "Protocol/ProtocolRequests.h"
#include "Protocol/ProtocolTypes.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBPlatform.h"
#include "llvm/Support/Error.h"
#include <utility>
@@ -136,7 +137,9 @@ void SendProcessEvent(DAP &dap, LaunchMethod launch_method) {
EmplaceSafeString(body, "name", exe_path);
const auto pid = dap.target.GetProcess().GetProcessID();
body.try_emplace("systemProcessId", (int64_t)pid);
- body.try_emplace("isLocalProcess", true);
+ body.try_emplace("isLocalProcess",
+ dap.target.GetPlatform().GetName() ==
+ lldb::SBPlatform::GetHostPlatform().GetName());
const char *startMethod = nullptr;
switch (launch_method) {
case Launch:
diff --git a/lldb/tools/lldb-dap/Handler/RestartRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RestartRequestHandler.cpp
index 45dd7ddce0428..706e66fd643a3 100644
--- a/lldb/tools/lldb-dap/Handler/RestartRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RestartRequestHandler.cpp
@@ -124,6 +124,8 @@ void RestartRequestHandler::operator()(
return;
}
+ SendProcessEvent(dap, Attach);
+
// This is normally done after receiving a "configuration done" request.
// Because we're restarting, configuration has already happened so we can
// continue the process right away.
More information about the lldb-commits
mailing list