[Lldb-commits] [PATCH] D147831: [lldb-vscode] Implement RestartRequest

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 7 18:19:50 PDT 2023


jgorbe created this revision.
jgorbe added reviewers: clayborg, wallace, labath, rupprecht.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147831

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/source/API/SBProcess.cpp
  lldb/test/API/tools/lldb-vscode/restart/Makefile
  lldb/test/API/tools/lldb-vscode/restart/TestVSCode_restart.py
  lldb/test/API/tools/lldb-vscode/restart/TestVSCode_restart_runInTerminal.py
  lldb/test/API/tools/lldb-vscode/restart/main.c
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147831.511833.patch
Type: text/x-patch
Size: 26486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230408/72c02dcc/attachment-0001.bin>


More information about the lldb-commits mailing list