Skip to content

Breakpoints jump to different lines to where they were added #5157

Closed

Description

@FMorschel

Describe the bug
While adding new breakpoints sometimes other existing ones go invisible.

To Reproduce
Steps to reproduce the behavior:

I am unsure what to write besides having a project and adding/removing breakpoints. I have not managed to reproduce it reliably.

Expected behavior
For all breakpoints to appear or at the worst case to move some lines up/down if the line cant be paused at.

Screenshots

20240627_131403.mp4

Please complete the following information:

Workspace Environment
Dart Code extension: 3.90.0
Flutter extension: 3.91.20240529 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.90.2

Workspace type: Flutter (LSP)

Dart (3.4.3): C:\Users\user\.puro\shared\caches\edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4\dart-sdk
Flutter (3.22.2): C:\Users\user\.puro\envs\stable\flutter (SM G780F (android-arm64/android))

Output from 'dart info'

C:\Users\user\.puro\shared\caches\edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4\dart-sdk\bin\dart.exe info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.4.3 (stable) (Tue Jun 4 19:51:39 2024 +0000) on "windows_x64"
  • on windows / "Windows 10 Pro" 10.0 (Build 22631)
  • locale is pt-BR

Project info

  • sdk constraint: '>=3.0.0 <4.0.0'
  • dependencies: async, bloc, brasil_fields, cached_network_image, cloud_firestore, collection, community_charts_flutter, connectivity_plus, convex_bottom_bar, cross_file, currency_text_input_formatter, dartz, device_info_plus, dio, dio_http_cache, direct_select, due_date, equatable, firebase_auth, firebase_core, flutter, flutter_custom_clippers, flutter_easyloading, flutter_keyboard_visibility, flutter_localizations, flutter_signature_pad, flutter_speed_dial, flutter_spinbox, flutter_staggered_grid_view, flutter_vibrate, font_awesome_flutter, grouped_list, image, intl, location, logging, mailer, mask_text_input_formatter, material_design_icons_flutter, package_info_plus, path, path_provider, pdf, percent_indicator, provider, scoped_model, search_cep, share_plus, shared_preferences, sqflite, syncfusion_flutter_datepicker, syncfusion_localizations, time, tutorial_coach_mark, url_launcher, validators, wakelock_plus, xml
  • dev_dependencies: dart_code_metrics, flutter_lints, flutter_test, test
  • elided dependencies: 10

Process info

Memory CPU Elapsed time Command line
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
Output from 'flutter doctor'

C:\Users\user\.puro\envs\stable\flutter\bin\flutter.bat doctor -v

[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3737], locale pt-BR)
    • Flutter version 3.22.2 on channel stable at C:\Users\user\.puro\envs\stable\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (3 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\user\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Users\user\AppData\Local\Programs\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33403.182
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Users\user\AppData\Local\Programs\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)

[√] VS Code (version 1.90.2)
    • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.86.0

[√] VS Code (version 1.88.0-insider)
    • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.64.0

[√] Connected device (4 available)
    • SM G780F (mobile) • 192.168.200.50:38525 • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows              • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Chrome (web)      • chrome               • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge                 • web-javascript • Microsoft Edge 125.0.2535.85

[!] Network resources
    X A network error occurred while checking "https://pub.dev/": Failed host lookup: 'pub.dev'
    X A network error occurred while checking "https://storage.googleapis.com/": Failed host lookup: 'storage.googleapis.com'
    X A network error occurred while checking "https://maven.google.com/": Failed host lookup: 'maven.google.com'
    X A network error occurred while checking "https://cocoapods.org/": Failed host lookup: 'cocoapods.org'
    X A network error occurred while checking "https://github.com/": Failed host lookup: 'github.com'

! Doctor found issues in 1 category.
Here the captured debug logs
Dart Code extension: 3.90.0
Flutter extension: 3.91.20240529 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.90.2

Workspace type: Flutter (LSP)

Dart (3.4.3): C:\Users\user\.puro\shared\caches\edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4\dart-sdk
Flutter (3.22.2): C:\Users\user\.puro\envs\stable\flutter (No device)


Logging Categories:
    General, AnalyzerTiming, CommandProcesses, DartTest, DartToolingDaemon, DAP, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, WebDaemon

Thu Jun 27 2024 [13:12:40 GMT-0300 (Horário Padrão de Brasília)] Log file started
[13:12:41] [DAP] [Info] ==> {"command":"setBreakpoints","arguments":{"source":{"adapterData":{"type":"@Script","id":"libraries/@278114389/scripts/package%3Agestao_vendas%2Fsrc%2Fpages%2Fclientes%2Fpedido%2FprodutosLista%2Fprodutos_lista.dart/1905a77955d","fixedId":true,"uri":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart"},"name":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart","path":"c:\\Users\\user\\SUNSIG\\trunk\\Delphiap\\Desenvol\\Sunsoft Flutter\\Vendas\\gestao_vendas\\lib\\src\\pages\\clientes\\pedido\\produtosLista\\produtos_lista.dart"},"lines":[630,569,637,627],"breakpoints":[{"line":630},{"line":569},{"line":637},{"line":627}],"sourceModified":false},"type":"request","seq":453}
[13:12:41] [DAP] [Info] <== {"seq":22841,"type":"response","body":{"breakpoints":[{"id":100061,"verified":false},{"id":100062,"verified":false},{"id":100063,"verified":false},{"id":100064,"verified":false}]},"command":"setBreakpoints","request_seq":453,"success":true}
[13:12:41] [DAP] [Info] <== {"seq":22842,"type":"event","body":{"breakpoint":{"column":7,"id":100061,"line":75,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:41] [DAP] [Info] <== {"seq":22843,"type":"event","body":{"breakpoint":{"column":9,"id":100062,"line":48,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:41] [DAP] [Info] <== {"seq":22844,"type":"event","body":{"breakpoint":{"column":7,"id":100063,"line":75,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:41] [DAP] [Info] <== {"seq":22845,"type":"event","body":{"breakpoint":{"column":11,"id":100064,"line":506,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:42] [DAP] [Info] ==> {"command":"setBreakpoints","arguments":{"source":{"adapterData":{"type":"@Script","id":"libraries/@278114389/scripts/package%3Agestao_vendas%2Fsrc%2Fpages%2Fclientes%2Fpedido%2FprodutosLista%2Fprodutos_lista.dart/1905a77955d","fixedId":true,"uri":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart"},"name":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart","path":"c:\\Users\\user\\SUNSIG\\trunk\\Delphiap\\Desenvol\\Sunsoft Flutter\\Vendas\\gestao_vendas\\lib\\src\\pages\\clientes\\pedido\\produtosLista\\produtos_lista.dart"},"lines":[569,630,627,627],"breakpoints":[{"line":569},{"line":630},{"line":627},{"line":627}],"sourceModified":false},"type":"request","seq":454}
[13:12:43] [DAP] [Info] <== {"seq":22846,"type":"response","body":{"breakpoints":[{"id":100065,"verified":false},{"id":100066,"verified":false},{"id":100067,"verified":false},{"id":100068,"verified":false}]},"command":"setBreakpoints","request_seq":454,"success":true}
[13:12:43] [DAP] [Info] <== {"seq":22847,"type":"event","body":{"breakpoint":{"column":66,"id":100065,"line":569,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:43] [DAP] [Info] <== {"seq":22848,"type":"event","body":{"breakpoint":{"column":57,"id":100067,"line":567,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:43] [DAP] [Info] <== {"seq":22849,"type":"event","body":{"breakpoint":{"column":57,"id":100068,"line":567,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:45] [DAP] [Info] ==> {"command":"setBreakpoints","arguments":{"source":{"adapterData":{"type":"@Script","id":"libraries/@278114389/scripts/package%3Agestao_vendas%2Fsrc%2Fpages%2Fclientes%2Fpedido%2FprodutosLista%2Fprodutos_lista.dart/1905a77955d","fixedId":true,"uri":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart"},"name":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart","path":"c:\\Users\\user\\SUNSIG\\trunk\\Delphiap\\Desenvol\\Sunsoft Flutter\\Vendas\\gestao_vendas\\lib\\src\\pages\\clientes\\pedido\\produtosLista\\produtos_lista.dart"},"lines":[569,627,627],"breakpoints":[{"line":569},{"line":627},{"line":627}],"sourceModified":false},"type":"request","seq":455}
[13:12:45] [DAP] [Info] <== {"seq":22850,"type":"response","body":{"breakpoints":[{"id":100069,"verified":false},{"id":100070,"verified":false},{"id":100071,"verified":false}]},"command":"setBreakpoints","request_seq":455,"success":true}
[13:12:45] [DAP] [Info] <== {"seq":22851,"type":"event","body":{"breakpoint":{"column":51,"id":100069,"line":626,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:45] [DAP] [Info] <== {"seq":22852,"type":"event","body":{"breakpoint":{"column":26,"id":100070,"line":630,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:45] [DAP] [Info] <== {"seq":22853,"type":"event","body":{"breakpoint":{"column":26,"id":100071,"line":630,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:47] [DAP] [Info] ==> {"command":"setBreakpoints","arguments":{"source":{"adapterData":{"type":"@Script","id":"libraries/@278114389/scripts/package%3Agestao_vendas%2Fsrc%2Fpages%2Fclientes%2Fpedido%2FprodutosLista%2Fprodutos_lista.dart/1905a77955d","fixedId":true,"uri":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart"},"name":"package:gestao_vendas/src/pages/clientes/pedido/produtosLista/produtos_lista.dart","path":"c:\\Users\\user\\SUNSIG\\trunk\\Delphiap\\Desenvol\\Sunsoft Flutter\\Vendas\\gestao_vendas\\lib\\src\\pages\\clientes\\pedido\\produtosLista\\produtos_lista.dart"},"lines":[569,627,637],"breakpoints":[{"line":569},{"line":627},{"line":637}],"sourceModified":false},"type":"request","seq":456}
[13:12:47] [DAP] [Info] <== {"seq":22854,"type":"response","body":{"breakpoints":[{"id":100072,"verified":false},{"id":100073,"verified":false},{"id":100074,"verified":false}]},"command":"setBreakpoints","request_seq":456,"success":true}
[13:12:47] [DAP] [Info] <== {"seq":22855,"type":"event","body":{"breakpoint":{"column":9,"id":100072,"line":48,"verified":true},"reason":"changed"},"event":"breakpoint"}
[13:12:47] [DAP] [Info] <== {"seq":22856,"type":"event","body":{"breakpoint":{"column":9,"id":100073,"line":511,"verified":true},"reason":"changed"},"event":"breakpoint"}
Thu Jun 27 2024 [13:12:51 GMT-0300 (Horário Padrão de Brasília)] Log file ended

Activity

  1. DanTup commented on Jul 2, 2024

    @DanTup
    Member

    From a quick glance at this, I think it could be the issue I discussed in dart-lang/sdk#55268 (comment) where we were reusing some cached information that we should not when resolving breakpoints which caused them to visibly (but not internally) move to an incorrect location (they should still break where expected).

    The fix for that is in Flutter master and should be in the next beta so if you're able to test on those I would love to know if everything is working correctly there. You can tell when the beta is updated when the latest commit shown at https://github.com/flutter/flutter/commits/beta/ is newer than the current one (which is 3.23.0 cherry-picks from June 6th).

  2. added
    awaiting infoRequires more information from the customer to progress
    on Jul 2, 2024
  3. github-actions commented on Jul 23, 2024

    @github-actions

    This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.

  4. DanTup commented on Jul 23, 2024

    @DanTup
    Member

    I was wrong in my comment above, the fix actually was already in the previous beta when I wrote it. So if you're able to test with the current Flutter beta, I would be interested to know if you see these issues there.

  5. github-actions commented on Aug 13, 2024

    @github-actions

    This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.

  6. FMorschel commented on Aug 13, 2024

    @FMorschel
    ContributorAuthor

    It does seem like those problems where solved!

    Althoug I did see one issue while debugging that I could not replicate with my static code. Maybe it has something to do with Hot Reload/Restart?

    Here in this video you can see that I place a breakpoint at line 130 and it ends up at line 132.

    20240813_172715.mp4

    With my debug session terminated I could click there no problem.

    Unfortunately I did not remembered to run any tools to try to get logs there. Although I did had every extension log and the vscode log to send here:

    Here is the download for the zip. If you ever get to this too late, just ask me and I can upload the same zip.

    EDIT

    If I run the code again, it does move the breakpoint over there to line 132.

  7. DanTup commented on Aug 22, 2024

    @DanTup
    Member

    I can reproduce this. I think the problem is that line 130 does not contain a valid location to stop (for example if you put a breakpoint on line 128 and then keep "stepping into", it will never stop at 130.

    However, I think in in previous discussions we came to the conclusion that breakpoints should never jump lines and instead should go unresolved (eg. it should stay on line 130 as greyed).

    The VM traffic shows that the breakpoint does move - in my repro, I'm putting a breakpoint on line 8 here, but it jumps to line 10:

    image

    The request to/from the VM looks like:

    ==> [VM] {
    	"jsonrpc": "2.0",
    	"id": "18",
    	"method": "addBreakpointWithScriptUri",
    	"params": {
    		"isolateId": "isolates/5456243470971291",
    		"scriptUri": "file:///C:/Dev/Test%20Projects/dartcode_5157/bin/dartcode_5157.dart",
    		// ################ Line 8 here
    		"line": 8
    	}
    }
    <== [VM] {
    	"jsonrpc": "2.0",
    	"result": {
    		"type": "Breakpoint",
    		"fixedId": true,
    		"id": "breakpoints/3",
    		"enabled": true,
    		"breakpointNumber": 3,
    		"resolved": true,
    		"location": {
    			"type": "SourceLocation",
    			"script": {
    				"type": "@Script",
    				"fixedId": true,
    				"id": "libraries/@18274781/scripts/file%3A%2F%2F%2FC%3A%2FDev%2FTest%2520Projects%2Fdartcode_5157%2Fbin%2Fdartcode_5157.dart/19179ede50c",
    				"uri": "file:///C:/Dev/Test%20Projects/dartcode_5157/bin/dartcode_5157.dart",
    				"_kind": "kernel"
    			},
    			"tokenPos": 181,
    			// ################ Line 10 here
    			"line": 10,
    			"column": 6
    		}
    	},
    	"id": "18"
    }
    

    @bkonyi @derekxu16 we discussed this a while back and I think we concluded breakpoints should not move like this. Ben noted that the VM Service spec says:

    If no breakpoint is possible at that line, the 102 (Cannot add breakpoint) RPC error code is returned.

    I think it would be easier to understand and explain "my breakpoint doesn't work on [this line that can't be stopped on]" compared to "my breakpoint moves to another line", but I don't know if there are additional nuances of this I haven't considered.

  8. changed the title [-]Breakpoints go invisible when adding new ones[/-] [+]Breakpoints jump to different lines to where they were added[/+] on Aug 22, 2024
  9. removed
    awaiting infoRequires more information from the customer to progress
    on Aug 22, 2024
  10. added this to the v3.96.0 milestone on Aug 22, 2024
  11. 4 remaining items

  12. modified the milestones: v3.98.0, v3.100.0 on Sep 30, 2024
  13. bkonyi commented on Sep 30, 2024

    @bkonyi

    Yeah, at the very least this issue needs to be in the SDK repo since it's a debugger issue, not a debugger client issue.

  14. DanTup commented on Sep 30, 2024

    @DanTup
    Member

    Thanks - I've opened dart-lang/sdk#56820 for this and will close this one.

  15. added and removed
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Sep 30, 2024
  16. removed this from the v3.100.0 milestone on Sep 30, 2024
  17. added this to the v3.100.0 milestone on Oct 16, 2024
  18. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in debuggingRelates to the debug adapter or process of running debug sessions
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    and removed on Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in dart / flutterin debuggingRelates to the debug adapter or process of running debug sessionsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions