-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Breakpoints aren't hit inside "part" files #35859
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@DanTup Hi Danny, I failed to reproduce the bug with your files on Linux. I used observatory to set breakpoints at func.dart and it then hit the breakpoint if I continued running. The code is latest from master branch. |
It is still happening for me with VS Code (v1.31.0) |
@zichangg Yah, the issue only seems to occur for the breakpoints that are sent at startup while the isolate is paused (PauseStart?). If I add breakpoints later via Observatory, they work fine. It may also happen with IntelliJ, I'm not sure. Assuming you have VS Code set up, you can capture a log while reproducing by running the Let me know if you have any trouble reproducing! |
@DanTup Have a great weekend! |
@zichangg The breakpoints seem to be expected as To be honest, this stuff isn't well documented and it's been a lot of trial and error (and bugs). It would be best if the formats for breakpoints could be explicitly documented to avoid confusion like this (this has come up before, because often there have been mismatches across platforms - for ex see #32500). We used to send every breakpoint twice (once as |
Blocked on #36023. |
This will enable the VM to map URIs to package-URIs to solve problems such as #35859 Change-Id: I15520325a5b81a99a7e3f56c2e35fd775d9da946 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96905 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
@jensjoha thanks for this! Though I just built the SDK locally and still don't seem to hit the breakpoint. Here's the project I'm testing with (breakpoint is on the line I'm using this version of the SDK: Dart VM version: 2.2.1-edge.58882ffdd49afdfb53c7be15361340bb64760fe4 (Wed Mar 20 09:39:33 2019 +0000) on "macos_x64" And here's a log of the VM service chatter: Any ideas what's wrong? |
Hmm... I think that's a VM bug (or VSCode somehow setting breakpoints too soon according to who knows what) --- if you add a breakpoint to the line in main, then, when it stops there, add the breakpoint to package:hello_world/part.dart:4 and continues, it does actually stop in the part file... |
From the logs it looks like the isolate was in the |
Reverting a051696 seems to fix the issue so maybe @alexmarkov would be the person to ping here. The issue seems to be that the top level class stuff is delayed, i.e. when you set the breakpoint that part is not known by the VM yet. A latent breakpoint is set, and I suppose that would be fine if A "funny" thing is that if you add, e.g. "class Foo {}" and the end of "part.dart", the breakpoint is set just fine because that class is created (and thus the VM gets to know about the part up front). |
The breakpoints sent from IDE will be checked with existing scripts. Because the loadedscripts() doesn't contain the scripts info for part/part of. Then the breakpoint will be considerred as a latent breakpoint and didn't get resolved later. The solution is to finalize the toplevel class before loadedscripts() uses Dictionary iterator. Bug: #35859 Change-Id: I90b67ee9e9e6afe2556ca806cdd87eb5661304a8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97402 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
With @zichangg's most recent change, this seems to be working as expect. Thanks both! 👍 |
… library" This reverts commit 9f00d1b. Reason for revert: This change triggered some incorrect runtime typecheck failures in Fuchsia. Original change's description: > [VM] Ensure Top level class is finalized for loadedscripts in library > > The breakpoints sent from IDE will be checked with existing scripts. > Because the loadedscripts() doesn't contain the scripts info for part/part of. > Then the breakpoint will be considerred as a latent breakpoint and didn't get > resolved later. The solution is to finalize the toplevel class before loadedscripts() > uses Dictionary iterator. > > Bug: #35859 > Change-Id: I90b67ee9e9e6afe2556ca806cdd87eb5661304a8 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97402 > Reviewed-by: Alexander Markov <alexmarkov@google.com> > Commit-Queue: Zichang Guo <zichangguo@google.com> TBR=alexmarkov@google.com,asiva@google.com,zichangguo@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: #35859 Change-Id: Ib28c2257f94b8d7ee0a3607be4a92153b7229e54 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98360 Reviewed-by: Zach Anderson <zra@google.com>
The fix caused incorrect type finalization and was reverted. We need to find another way of fixing this. |
If this isn't likely to happen soon, do you know if there's a workaround? I tried switching from package URIs to file URIs (based on the original comments here), though that didn't seem to help (thanks to @bkonyi fixes, it's likely VS Code will move over to always using file URIs instead of package URIs for breakpoints soon). |
Following the revert #98360, make sure the finalizing happens only in debugger. Create the test cases to demonstrate the behavior. Bug: #35859 Change-Id: Ib27fef18a7c0696ec6dc6d045fa06f60677333c8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98422 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
Moving from Dart-Code/Dart-Code#1443
It seems if you include a file using
part
/part-of
then breakpoints set inside it aren't hit (at least, those set by VS Code while the app is paused at startup).Here's a repro:
pubspec.yaml
bin/main.dart
lib/all_scripts.dart
lib/src/func.dart
If I move
func
directly intoall_scripts
then it works fine.breakpoint_test.zip
Some info on what be the issue from @peter-ahe-google:
My guess it that there could be a flaw in how the VM maps fileUris to importUris (this is a concept from Kernel, let me know if I need to elaborate).
We only store a fileUri on
func
. So you have to translate that back to the importUri, and it is not sufficient to look at the enclosing library's importUri.I think it would be more reliable to translate importUris to fileUris (that is, convert package-URIs to file-URIs), because the debug information is based on those.
The text was updated successfully, but these errors were encountered: