Skip to content

Breakpoints don't work until after reload on macOS + iOS Simulator #357

Closed

Description

@mit-mit

While testing beta5:

  1. flutter create testapp
  2. cd testapp
  3. code .
  4. add breakpoint in line 59 (_counter++;)
  5. Hit F5
  6. Press + button in app => nothing happened
  7. Tried to add a few more breakpoints + hit Restart => nothing happened
  8. Tried to add a few more breakpoints + change a widget + hit Restart => this error:
Lost connection to device.
Runner(23447,0x70000c83c000) malloc: *** error for object 0x600000059bc0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Activity

  1. mit-mit commented on Jul 7, 2017

    @mit-mit
    ContributorAuthor

    And then after that, restarted the app, changed another string, hit restart, and now breakpoints are triggering! It seems something doesn't quite work on the first breakpoint sync?

  2. DanTup commented on Jul 7, 2017

    @DanTup
    Member

    @mit-mit Thanks for testing! Could you try a few things for me?

    1. Set dart.flutterRunLogFile and dart.observatoryLogFile to paths for logging (currently, the folders must exist, the files do not) to enable blogging of comms with flutter and observatory
    2. After launching the app when the breakpoints don't work (before reloading or trying to fix), open the flutter run log file and find the port number for Observatory and connect to it in your browser and find the path that the VM believe the files live in

    My guess is that there's a mismatch in the paths that Dart Code got from your local machine and what the VM thinks (similar to #336, though that was post-reload that was wrong).

    If you can provide me the path that Dart Code actually sent (this will be in the addBreakpoint calls in the Observatory log) and what the VM thinks (you can get this from Observatory in the browser) and it's different I can figure out how to change.

  3. added this to the v2.0 milestone on Jul 7, 2017
  4. added
    in debugging
    in flutter
    on Jul 7, 2017
  5. DanTup commented on Jul 7, 2017

    @DanTup
    Member

    Also - I think the error you posted may be a bug in Flutter/Dart; I don't think Dart Code should be able to cause that even if it tried!

    I'd still like to know if you can repro this though; it's possible the breakpoint misses are unrelated to the error posted and something I can fix.

  6. modified the milestones: v2.1, v2.0 on Jul 10, 2017
  7. DanTup commented on Jul 14, 2017

    @DanTup
    Member

    @mit-mit I'm up and running on Mac OS now and I can't repro this. However, I do have some similar issues (intermittent crashes) which I think are unrelated to Dart Code, eg.:

    screen shot 2017-07-14 at 15 00 28

    I don't think this is a Dart Code issue so I'm going to raise at flutter.

    Gonna close this since I can't repro and you haven't confirmed if you're still seeing it, but feel free to shout if you think there's still something wrong here.

  8. removed this from the v2.1 milestone on Jul 14, 2017
  9. mit-mit commented on Jul 17, 2017

    @mit-mit
    ContributorAuthor

    Sorry for the late response; I was out on vacation.

    I can not repro this on Windows, or in macOs against the Android emulator. But I can still repro this on macOS against the iOS Simulator:

    1. flutter create testapp
    2. cd testapp
    3. code .
    4. add breakpoint in line 59 (_counter++;)
    5. Hit F5
    6. Press + button in app

    => breakpoint not triggered

    1. Edit title: in line 25 to have a new string
    2. Reload
    3. Press + button in app

    => breakpoint is triggered

  10. reopened this on Jul 17, 2017
  11. DanTup commented on Jul 17, 2017

    @DanTup
    Member

    @mit-mit Thanks for investigating! I've managed to get up and running on Mac OS now but so far only with Android; I'm hoping to get iOS emulator working this week so I'll investigate again.

    There is an issue with Flutter on iOS (#358) which I presume you're not hitting; I don't think it's related since you'd see a frozen black screen.

    If I'm unable to repro, I might ask if you could enable dart.flutterRunLogFile and dart.observatoryLogFile (see CONTRIBUTING.md#enable-logging) and repro and attach the logs.

  12. changed the title [-]Cannot get breakpoint to work on macOS[/-] [+]Breakpoints don't work until after reload on macOS + iOS Simulator[/+] on Jul 17, 2017
  13. added this to the v2.2 milestone on Jul 17, 2017
  14. mit-mit commented on Jul 17, 2017

    @mit-mit
    ContributorAuthor

    Certainly, attached! The first two include the first six repro steps leading to the not working breakpoint.
    flutterRunLogFile1.txt
    observatoryLogFile1.txt

    The second two files include the last three with the reload.
    observatoryLogFile2.txt
    flutterRunLogFile2.txt

  15. DanTup commented on Jul 18, 2017

    @DanTup
    Member

    Ok; up and running with iOS Simulator now and I can reproduce!

    "baseUri":"file:///Users/danny/Library/Developer/CoreSimulator/Devices/C76BB178-2046-4302-B25B-0A747ECAA276/data/Containers/Data/Application/CCFE1472-7C21-4A5B-B733-022D49ADEEEB/tmp/test_breakpointskIQNRi/test_breakpoints/"
    
    "rootLib":{"type":"@Library","fixedId":true,"id":"libraries\/@16174969","name":"","uri":"\/Users\/danny\/Dev\/Testing\/test_breakpoints\/lib\/main.dart"}
    
    [9:37:50 PM]: ==> {"id":"443","method":"addBreakpointWithScriptUri","params":{"isolateId":"isolates/887577740","scriptUri":"file:///Users/danny/Dev/Testing/test_breakpoints/lib/main.dart","line":59}}
    

    Looks like the problem is that I'm sending file:/// for the script URI, but the VM doesn't have it. Similar to flutter/flutter#11040 there seems to be some confusion about the format of URIs :(

    The workaround for the above issue seems to not trigger here because of this if statement.. Probably the last two lines of that if condition need dropping outside the if so that they always apply, not just in the case of the remapped paths.

    Out of time for tonight, but I'll see if I can get this fixed on Thursday. Thanks for the help tracking it down and providing repro steps! :-)

  16. DanTup commented on Jul 18, 2017

    @DanTup
    Member

    Couldn't go without at least testing it! Slight refactor and it's working fine for me. Hope to push a new release out on Thurs. In the meantime, a workaround is to just hit Hot Reload immediately after launching (sorry that doesn't help with breakpoints in startup code!).

  17. DanTup commented on Jul 19, 2017

    @DanTup
    Member

    @mit-mit I've pushed out v2.2.0 with this fix in; please update and let me know if it resolves your issues!

  18. mit-mit commented on Jul 20, 2017

    @mit-mit
    ContributorAuthor

    Works great in v2.2.0; thanks much!

  19. DanTup commented on Jul 20, 2017

    @DanTup
    Member

    Great; thanks for confirming!

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

    in debuggingin flutteris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions