Skip to content

Commit 1b8aa6e

Browse files
committed
[lldb-dap] Assorted small fixes for runInTerminal
- 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 bdc1296 commit 1b8aa6e

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
@@ -1303,7 +1303,7 @@ llvm::json::Value CreateCompileUnit(lldb::SBCompileUnit &unit) {
13031303
/// https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_RunInTerminal
13041304
llvm::json::Object CreateRunInTerminalReverseRequest(
13051305
llvm::StringRef program, const std::vector<std::string> &args,
1306-
const llvm::StringMap<std::string> env, llvm::StringRef cwd,
1306+
const llvm::StringMap<std::string> &env, llvm::StringRef cwd,
13071307
llvm::StringRef comm_file, lldb::pid_t debugger_pid) {
13081308
llvm::json::Object run_in_terminal_args;
13091309
// This indicates the IDE to open an embedded terminal, instead of opening
@@ -1320,7 +1320,7 @@ llvm::json::Object CreateRunInTerminalReverseRequest(
13201320
req_args.push_back("--launch-target");
13211321
req_args.push_back(program.str());
13221322
req_args.insert(req_args.end(), args.begin(), args.end());
1323-
run_in_terminal_args.try_emplace("args", args);
1323+
run_in_terminal_args.try_emplace("args", req_args);
13241324

13251325
if (!cwd.empty())
13261326
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
@@ -530,7 +530,7 @@ llvm::json::Value CreateCompileUnit(lldb::SBCompileUnit &unit);
530530
/// Microsoft.
531531
llvm::json::Object CreateRunInTerminalReverseRequest(
532532
llvm::StringRef program, const std::vector<std::string> &args,
533-
const llvm::StringMap<std::string> env, llvm::StringRef cwd,
533+
const llvm::StringMap<std::string> &env, llvm::StringRef cwd,
534534
llvm::StringRef comm_file, lldb::pid_t debugger_pid);
535535

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

0 commit comments

Comments
 (0)