summaryrefslogtreecommitdiff
path: root/lldb/packages
diff options
context:
space:
mode:
authorJorge Gorbe Moya <jgorbe@google.com>2023-04-10 18:37:03 -0700
committerJorge Gorbe Moya <jgorbe@google.com>2023-05-02 14:50:39 -0700
commit2b6c5bb995be1b675c1d92e2d46403c76764e5c7 (patch)
tree76b351041f7be65dcb50bcb3836e533036305b6a /lldb/packages
parentc64f10bfe20308ebc7d5d18912cd0ba82a44eaa1 (diff)
downloadllvm-2b6c5bb995be1b675c1d92e2d46403c76764e5c7.tar.gz
[lldb-vscode] Implement RestartRequest
This is an optional request, but supporting it makes the experience better when re-launching a big binary that takes significant time to parse: instead of tearing down and re-create the whole session we just need to kill the current process and launch a new one. Some non-obvious comments that might help review this change: * After killing the process, we get an "exited" event for it. Because the process no longer exists some interesting things can occur that manifest as flaky failures if not dealt with: - `EventIsProcessEvent` relies on `SBEvent::GetBroadcasterClass`, which can crash if the broadcaster is no longer there: the event only holds a weak_ptr to its broadcaster, and `GetBroadcasterClass` uses it without checking. Other `EventIs*` functions look at the flavor of the EventData, so I have modified EventIsProcessEvent to do that. - We keep the PID of the old process so we can detect its "exited" event and not terminate the whole session. But sometimes the SBProcess we get from the event won't have a PID, for some reason. * I have factored out the code to launch a process out to a new LaunchProcess function, so it can be used from both `request_launch` and `request_restart`. * The restart_runInTerminal test has the same problem with debug builds as the original runInTerminal test: when attaching to the launcher instance of lldb-vscode it takes a long time to parse its debug info. I have used the same workaround to disable that particular test for debug builds. Differential Revision: https://reviews.llvm.org/D147831
Diffstat (limited to 'lldb/packages')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index c2de4ad5c7d9..16d26a8fa221 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -588,6 +588,15 @@ class DebugCommunication(object):
# Caller must still call wait_for_stopped.
return response
+ def request_restart(self):
+ command_dict = {
+ 'command': 'restart',
+ 'type': 'request',
+ }
+ response = self.send_recv(command_dict)
+ # Caller must still call wait_for_stopped.
+ return response
+
def request_disconnect(self, terminateDebuggee=None):
args_dict = {}
if terminateDebuggee is not None: