You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
In D59401005, `ResetDebuggerState()` was added as a part of the "reuse lldb-dap" change. The intention of the method is to reset any state related to the debugger, so that it will be a clean start for new debug sessions.
However, clearing `exception_breakpoints` will cause exception breakpoints to disappear in VS Code for new debug sessions. See first video in "Test Plan" section.
Here is why:
The exception breakpoints are added into `exception_breakpoints` by `PopulateExceptionBreakpoints()`. This function has a `llvm::call_once` - it will only execute once during the whole lifetime of the process. Clearing `exception_breakpoints` at the end of the 1st debug session means that any 2nd+ sessions will see an empty list. See diff comment.
The following properties are true:
1. In a single debug session, the list of `ExceptionBreakpoint` objects (and the `SBBreakpoint` objects within) remain the same. This ensures consistency within the session when the list of exception breakpoints are interacted.
2. When reusing lldb-dap, the list is cleared between sessions and is repopulated the first time `PopulateExceptionBreakpoints()` is called in each session. This differs from before the diff, where 2nd+ sessions don't repopulate the list. This fixes the bug.
Test Plan:
By debugging a c++ toy program and observe the existence of the exception breakpoints in VS Code Local.
**Before the change:** Exception breakpoints exist for the 1st debug session, but disappears for 2nd+ sessions.
https://pxl.cl/6CBK7
**After the change:** Exception breakpoints exist for all debug sessions.
https://pxl.cl/6CBKl
**Test fails __before__ the change:**
```
1516 ROYDEBUG BEGIN OF 1
...
1518 ROYDEBUG END OF 1
1519 ROYDEBUG BEGIN OF 2
...
3096 AssertionError: False is not true : verify we got "C++ Throw"
```
Look at this diff's V5 for where the "ROYDEBUG" print statements are in the test. This verifies that the verification failed during the 2nd debug session.
See full test output: P1742862144
**Test passes __after__ the change:**
```
[[email protected] ~/llvm-sand/build/Debug/fbcode-x86_64/toolchain]$ bin/llvm-lit -sv /home/royshi/llvm-sand/external/llvm-project/lldb/test/API/tools/lldb-dap/reuseDAP/TestDAP_reuseAdapter.py
Testing Time: 5.12s
Total Discovered Tests: 1
Passed: 1 (100.00%)
[[email protected] ~/llvm-sand/build/Debug/fbcode-x86_64/toolchain]$
```
Reviewers: jeffreytan, #lldb_team
Reviewed By: jeffreytan
Subscribers: davidayoung, mavitale, jalalonde, #lldb_team
Differential Revision: https://phabricator.intern.facebook.com/D69966150
Tasks: T214613938
0 commit comments