Author: John Harrison
Date: 2023-06-29T14:50:19-04:00
New Revision: fc52f8dc6ce2ddd19b7b0f5ffdc9598c3abe105f

URL: 
https://github.com/llvm/llvm-project/commit/fc52f8dc6ce2ddd19b7b0f5ffdc9598c3abe105f
DIFF: 
https://github.com/llvm/llvm-project/commit/fc52f8dc6ce2ddd19b7b0f5ffdc9598c3abe105f.diff

LOG: [lldb-vscode] Prior to running the launchCommands during a launch request 
set the launch info so the configured launch information is accessible by the 
launch commands.

Reviewed By: wallace

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-vscode/README.md 
b/lldb/tools/lldb-vscode/README.md
index 67dfa54ed4519..cd249ed2fac7c 100644
--- a/lldb/tools/lldb-vscode/README.md
+++ b/lldb/tools/lldb-vscode/README.md
@@ -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.

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index b9757d166958b..5815b0d22506b 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -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.


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to