[lldb-vscode] Prior to running the launchCommands during a launch request set the...
authorJohn Harrison <harjohn@google.com>
Thu, 29 Jun 2023 18:49:17 +0000 (14:49 -0400)
committerDavid Goldman <davg@google.com>
Thu, 29 Jun 2023 18:50:19 +0000 (14:50 -0400)
Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D154028

lldb/tools/lldb-vscode/README.md
lldb/tools/lldb-vscode/lldb-vscode.cpp

index 67dfa54..cd249ed 100644 (file)
@@ -95,6 +95,7 @@ file that defines how your program will be run. The JSON configuration file can
 |**initCommands**   |[string]| | LLDB commands executed upon debugger startup prior to creating the LLDB target. Commands and command output will be sent to the debugger console when they are executed.
 |**preRunCommands** |[string]| | LLDB commands executed just before launching after the LLDB target has been created. Commands and command output will be sent to the debugger console when they are executed.
 |**stopCommands**   |[string]| | LLDB commands executed just after each stop. Commands and command output will be sent to the debugger console when they are executed.
+|**launchCommands** |[string]| | LLDB commands executed to launch the program. Commands and command output will be sent to the debugger console when they are executed.
 |**exitCommands**   |[string]| | LLDB commands executed when the program exits. Commands and command output will be sent to the debugger console when they are executed.
 |**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends. Commands and command output will be sent to the debugger console when they are executed.
 |**sourceMap**      |[string[2]]| | Specify an array of path re-mappings. Each element in the array must be a two element array containing a source and destination pathname.
index b9757d1..5815b0d 100644 (file)
@@ -1695,6 +1695,9 @@ lldb::SBError LaunchProcess(const llvm::json::Object &request) {
     g_vsc.target.Launch(launch_info, error);
     g_vsc.debugger.SetAsync(true);
   } else {
+    // Set the launch info so that run commands can access the configured
+    // launch details.
+    g_vsc.target.SetLaunchInfo(launch_info);
     g_vsc.RunLLDBCommands("Running launchCommands:", launchCommands);
     // The custom commands might have created a new target so we should use the
     // selected target after these commands are run.