-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[lldb-dap] Improving the naming consistency of startDebugging reverse request. #112396
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
Conversation
… request. Adjusting the name from `lldb-dap startDebugging` to `lldb-dap start-debugging` to improve consistency with other names for commands in lldb/lldb-dap.
|
@llvm/pr-subscribers-lldb Author: John Harrison (ashgti) ChangesAdjusting the name from Full diff: https://github.com/llvm/llvm-project/pull/112396.diff 4 Files Affected:
diff --git a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
index fd48e69cae5e25..fd452d91e472bd 100644
--- a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
+++ b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
@@ -1,12 +1,10 @@
"""
-Test lldb-dap startDebugging reverse request
+Test lldb-dap start-debugging reverse requests.
"""
-import dap_server
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
import lldbdap_testcase
@@ -25,7 +23,7 @@ def test_startDebugging(self):
self.set_source_breakpoints(source, [breakpoint_line])
self.continue_to_next_stop()
self.dap_server.request_evaluate(
- "`lldb-dap startDebugging attach '{\"pid\":321}'", context="repl"
+ "`lldb-dap start-debugging attach '{\"pid\":321}'", context="repl"
)
self.continue_to_exit()
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 6012ee52110b73..a6904e4daeec3d 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -863,42 +863,35 @@ int64_t Variables::InsertExpandableVariable(lldb::SBValue variable,
bool StartDebuggingRequestHandler::DoExecute(
lldb::SBDebugger debugger, char **command,
lldb::SBCommandReturnObject &result) {
- // Command format like: `startDebugging <launch|attach> <configuration>`
+ // Command format like: `start-debugging <launch|attach> <configuration>`
if (!command) {
- result.SetError("Invalid use of startDebugging");
- result.SetStatus(lldb::eReturnStatusFailed);
+ result.SetError("Invalid use of start-debugging, expected format "
+ "`start-debugging <launch|attach> <configuration>`.");
return false;
}
if (!command[0] || llvm::StringRef(command[0]).empty()) {
- result.SetError("startDebugging request type missing.");
- result.SetStatus(lldb::eReturnStatusFailed);
+ result.SetError("start-debugging request type missing.");
return false;
}
if (!command[1] || llvm::StringRef(command[1]).empty()) {
- result.SetError("configuration missing.");
- result.SetStatus(lldb::eReturnStatusFailed);
+ result.SetError("start-debugging debug configuration missing.");
return false;
}
llvm::StringRef request{command[0]};
std::string raw_configuration{command[1]};
- int i = 2;
- while (command[i]) {
- raw_configuration.append(" ").append(command[i]);
- }
-
llvm::Expected<llvm::json::Value> configuration =
llvm::json::parse(raw_configuration);
if (!configuration) {
llvm::Error err = configuration.takeError();
- std::string msg =
- "Failed to parse json configuration: " + llvm::toString(std::move(err));
+ std::string msg = "Failed to parse json configuration: " +
+ llvm::toString(std::move(err)) + "\n\n" +
+ raw_configuration;
result.SetError(msg.c_str());
- result.SetStatus(lldb::eReturnStatusFailed);
return false;
}
diff --git a/lldb/tools/lldb-dap/README.md b/lldb/tools/lldb-dap/README.md
index 11a14d29ab51e2..7328c19c1718b0 100644
--- a/lldb/tools/lldb-dap/README.md
+++ b/lldb/tools/lldb-dap/README.md
@@ -209,9 +209,9 @@ The default hostname being used `localhost`.
The `lldb-dap` tool includes additional custom commands to support the Debug
Adapter Protocol features.
-### startDebugging
+### start-debugging
-Using the command `lldb-dap startDebugging` it is possible to trigger a
+Using the command `lldb-dap start-debugging` it is possible to trigger a
reverse request to the client requesting a child debug session with the
specified configuration. For example, this can be used to attached to forked or
spawned processes. For more information see
@@ -220,7 +220,7 @@ spawned processes. For more information see
The custom command has the following format:
```
-lldb-dap startDebugging <launch|attach> <configuration>
+lldb-dap start-debugging <launch|attach> <configuration>
```
This will launch a server and then request a child debug session for a client.
@@ -229,7 +229,7 @@ This will launch a server and then request a child debug session for a client.
{
"program": "server",
"postRunCommand": [
- "lldb-dap startDebugging launch '{\"program\":\"client\"}'"
+ "lldb-dap start-debugging launch '{\"program\":\"client\"}'"
]
}
```
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index c5c4b09f15622b..e48d6bae89cdde 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -1629,7 +1629,7 @@ void request_initialize(const llvm::json::Object &request) {
"lldb-dap", "Commands for managing lldb-dap.");
if (GetBoolean(arguments, "supportsStartDebuggingRequest", false)) {
cmd.AddCommand(
- "startDebugging", new StartDebuggingRequestHandler(),
+ "start-debugging", new StartDebuggingRequestHandler(),
"Sends a startDebugging request from the debug adapter to the client "
"to start a child debug session of the same type as the caller.");
}
|
walter-erquinigo
left a comment
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.
cool
… request. (llvm#112396) Adjusting the name from `lldb-dap startDebugging` to `lldb-dap start-debugging` to improve consistency with other names for commands in lldb/lldb-dap.
… request. (llvm#112396) Adjusting the name from `lldb-dap startDebugging` to `lldb-dap start-debugging` to improve consistency with other names for commands in lldb/lldb-dap. (cherry picked from commit 224f62d)
Adjusting the name from
lldb-dap startDebuggingtolldb-dap start-debuggingto improve consistency with other names for commands in lldb/lldb-dap.