-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[lldb-dap] Send a 'process' event on restart. #163833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When we restart a process, send an updated 'process' event describing the newly launched process.
@llvm/pr-subscribers-lldb Author: John Harrison (ashgti) ChangesWhen we restart a process, send an updated 'process' event describing the newly launched process. I also updated the Full diff: https://github.com/llvm/llvm-project/pull/163833.diff 2 Files Affected:
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.
|
we could also add the |
lldb/tools/lldb-dap/EventHelper.cpp
Outdated
body.try_emplace("isLocalProcess", | ||
dap.target.GetPlatform().GetName() == | ||
lldb::SBPlatform::GetHostPlatform().GetName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expose Platform::IsHost
through the SB API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could make SBPlatform comparable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Knowing whether the process you are debugging is running locally seems a generally useful piece of information, that should be simple to ask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added bool SBPlatform::IsHost() const
to the lldb API.
Sure, that should be simple to add |
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.