Skip to content

Commit 695d725

Browse files
authored
[lldb-dap] Assorted small fixes for runInTerminal (#140908)
- `CreateRunInTerminalReverseRequest` is passed a `StringMap` by value, whose keys are owned and deallocated after return. - Target args are wrongly specified as reverse request (launcher) args. - Test case error message did not catch up with a0aa5f8. All runInTerminal tests are passing with this applied.
1 parent 689342d commit 695d725

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def test_runInTerminalInvalidTarget(self):
128128
)
129129
self.assertFalse(response["success"])
130130
self.assertIn(
131-
"Could not create a target for a program 'INVALIDPROGRAM': 'INVALIDPROGRAM' does not exist",
132-
response["message"],
131+
"'INVALIDPROGRAM' does not exist",
132+
response["body"]["error"]["format"],
133133
)
134134

135135
@skipIfWindows

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ llvm::json::Value CreateCompileUnit(lldb::SBCompileUnit &unit) {
13351335
/// https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_RunInTerminal
13361336
llvm::json::Object CreateRunInTerminalReverseRequest(
13371337
llvm::StringRef program, const std::vector<std::string> &args,
1338-
const llvm::StringMap<std::string> env, llvm::StringRef cwd,
1338+
const llvm::StringMap<std::string> &env, llvm::StringRef cwd,
13391339
llvm::StringRef comm_file, lldb::pid_t debugger_pid) {
13401340
llvm::json::Object run_in_terminal_args;
13411341
// This indicates the IDE to open an embedded terminal, instead of opening
@@ -1352,7 +1352,7 @@ llvm::json::Object CreateRunInTerminalReverseRequest(
13521352
req_args.push_back("--launch-target");
13531353
req_args.push_back(program.str());
13541354
req_args.insert(req_args.end(), args.begin(), args.end());
1355-
run_in_terminal_args.try_emplace("args", args);
1355+
run_in_terminal_args.try_emplace("args", req_args);
13561356

13571357
if (!cwd.empty())
13581358
run_in_terminal_args.try_emplace("cwd", cwd);

lldb/tools/lldb-dap/JSONUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ llvm::json::Value CreateCompileUnit(lldb::SBCompileUnit &unit);
544544
/// Microsoft.
545545
llvm::json::Object CreateRunInTerminalReverseRequest(
546546
llvm::StringRef program, const std::vector<std::string> &args,
547-
const llvm::StringMap<std::string> env, llvm::StringRef cwd,
547+
const llvm::StringMap<std::string> &env, llvm::StringRef cwd,
548548
llvm::StringRef comm_file, lldb::pid_t debugger_pid);
549549

550550
/// Create a "Terminated" JSON object that contains statistics

0 commit comments

Comments
 (0)