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

Unable to set breakpoints in global lambda #34742

Open
DanTup opened this Issue Oct 10, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@DanTup
Member

DanTup commented Oct 10, 2018

(Raised at Dart-Code/Dart-Code#1249 by @kentcb)

Given this code:

import 'package:test/test.dart';

typedef void VoidCallback();

void main() {
  final workingCase = SomeClass(() {
    // set a breakpoint on the following line and it will be hit
    print("Executing");
  });

  test("breakpoint works", () {
    workingCase.execute();
  });

  test("breakpoint does not work", () {
    nonWorkingCase.execute();
  });
}

class SomeClass {
  final VoidCallback execute;

  SomeClass(this.execute);
}

final nonWorkingCase = SomeClass(() {
  // set a breakpoint on the following line and it will not be hit
  print("Executing");
});

If you put breakpoints on the two marked locations, the second one gets rejected:

"details":"addBreakpointWithScriptUri: Cannot add breakpoint at line '28'"

If you run the file with dart --observe --pause-isolates-on-start .\test\broken_test.dart and then open in Observatory, the second breakpoint (the one that is missed) does not appear as a valid location to add a breakpoint:

obs

As far as I can see, the only difference between the code is that one is inside the main method and the other is not.

@DanTup DanTup changed the title from Missed breakpoints in global lambda to Unable to set breakpoints in global lambda Oct 10, 2018

@mit-mit mit-mit added the area-vm label Oct 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment