diff options
| author | Alex Langford <apl@fb.com> | 2019-08-19 20:17:27 +0000 |
|---|---|---|
| committer | Alex Langford <apl@fb.com> | 2019-08-19 20:17:27 +0000 |
| commit | 3b4ce731fbcc6490da95d8091b384c3ddb3c70d9 (patch) | |
| tree | b01c73ff4c875a906d35d6aa4891b8f5df3f45ed /lldb/tools | |
| parent | 928071ae4ef5e2e6342afb126518a79fde81cf8b (diff) | |
| download | bcm5719-llvm-3b4ce731fbcc6490da95d8091b384c3ddb3c70d9.tar.gz bcm5719-llvm-3b4ce731fbcc6490da95d8091b384c3ddb3c70d9.zip | |
[lldb-vscode] add `launchCommands` to handle launch specific commands
Summary:
This can help `lldb-vscode` handle launch commands associate with remote platform
attach request have field `attachCommands` to handle attach specific commands
add a corresponding one for launch request
if no launch command is provided, create a new target and launch; otherwise, execute the launch command
Differential Revision: https://reviews.llvm.org/D65363
Patch by Wanyi Ye <kusmour@gmail.com>
llvm-svn: 369296
Diffstat (limited to 'lldb/tools')
| -rw-r--r-- | lldb/tools/lldb-vscode/lldb-vscode.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index 57d218c2341..2810da62f60 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -1182,6 +1182,7 @@ void request_launch(const llvm::json::Object &request) { g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); + auto launchCommands = GetStrings(arguments, "launchCommands"); g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false); const auto debuggerRoot = GetString(arguments, "debuggerRoot"); @@ -1254,11 +1255,19 @@ void request_launch(const llvm::json::Object &request) { // Run any pre run LLDB commands the user specified in the launch.json g_vsc.RunPreRunCommands(); + if (launchCommands.empty()) { + // Disable async events so the launch will be successful when we return from + // the launch call and the launch will happen synchronously + g_vsc.debugger.SetAsync(false); + g_vsc.target.Launch(g_vsc.launch_info, error); + g_vsc.debugger.SetAsync(true); + } else { + 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. + g_vsc.target = g_vsc.debugger.GetSelectedTarget(); + } - // Disable async events so the launch will be successful when we return from - // the launch call and the launch will happen synchronously - g_vsc.debugger.SetAsync(false); - g_vsc.target.Launch(g_vsc.launch_info, error); if (error.Fail()) { response["success"] = llvm::json::Value(false); EmplaceSafeString(response, "message", std::string(error.GetCString())); @@ -1268,7 +1277,7 @@ void request_launch(const llvm::json::Object &request) { SendProcessEvent(Launch); g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized"))); // Reenable async events and start the event thread to catch async events. - g_vsc.debugger.SetAsync(true); + // g_vsc.debugger.SetAsync(true); } // "NextRequest": { |

