-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Case mismatch in setBreakpoints requests in a single session #232088
Comments
Yeah, there is a larger issue here, also related: #210854. I'll look at your PR, but the implications are a little confusing and it might be a partial fix. Why does the debugger return a different casing? Which is "correct"? |
At the time of initialization or early in debugging, the raw Source from debugger is not present for most breakpoints. At this point, we create a new raw source using vscode/src/vs/workbench/contrib/debug/browser/debugSession.ts Lines 1512 to 1513 in 848d216
This generally returns the canonicalized path which the editor decides. The debug adapter also sends Sources in different contexts as I can see, one of them being stack trace when a breakpoint hits. All the sources sent by the debug adapter are then cached in vscode/src/vs/workbench/contrib/debug/browser/debugSession.ts Lines 1508 to 1511 in 848d216
The issue occurs when the initial source created using This results in different setBreakpoint requests to have differently cased path for the same file on the editor side. This creates issues with some debuggers as noted in the issue. The "correct" casing can be debated, but I'd assume it is safe to send the canonical path which matches the file system. In any case, for this particular issue, "correct" might not be that important, but "consistent" is, since the issue only occurs because of difference in path handling in editor and debug adapter. |
@roblourens Any thoughts on this? I'd really appreciate if you can have a look at the issue and the associated PR. |
Does this issue occur when all extensions are disabled?: Yes
Issue:
In some cases, the
setBreakpoints
requests sent in the same session sends the path with different cases. Especially on case-insensitive file systems. This causes broken breakpoint experience on some debugger. Currently tested with CodeLLDB and android-debug on Windows. Issue is fairly easy to repro and affects across machines and projects.Debugging details:
After some debugging, here is what I gathered.
The issue boils down to the two different paths taken by
getRawSource
. For a local file, ifthis.sources
contains an entry for that URI, it directly returnssource.raw
. Otherwise, it returns name and path using canonical URI.vscode/src/vs/workbench/contrib/debug/browser/debugSession.ts
Lines 1507 to 1515 in 45a9f89
Form what I saw
this.sources
is populated when resolving frames on a breakpoint hit. The debugger sends frames with raw source info. That info is stored and used as is once available.The issue arises when the canonical path and the raw source from debugger doesn't match. e.g. canonical path is
<path>/Native-Lib.cpp
but the debugger reported<path>/native-lib.cpp
. This means that until thethis.sources
was populated for this Uri, we sent<path>/Native-Lib.cpp
when setting breakpoints. And later, we send<path>/native-lib.cpp
. This mismatch causes lldb to treat the paths differently and duplicate breakpoints.Potential solution:
The text was updated successfully, but these errors were encountered: