Skip to content
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

setLibraryDebuggable doesn't work as expected #27370

Closed
DanTup opened this issue Sep 16, 2016 · 4 comments
Closed

setLibraryDebuggable doesn't work as expected #27370

DanTup opened this issue Sep 16, 2016 · 4 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@DanTup
Copy link
Collaborator

DanTup commented Sep 16, 2016

It's entirely possible this is user error, but I'm not sure how to debug further.

For now, I'm trying to set all libraries as not-debuggable for testing; my startup code looks something like this:

return Promise.all(
    isolate.libraries.map(library => 
        this.observatory.setLibraryDebuggable(isolateRef.id, library.id, false)
    )
);

I can see the requests all being sent and success responses:

==> {"id":"4","method":"setExceptionPauseMode","params":{"isolateId":"isolates/360410364","mode":"Unhandled"}}
==> {"id":"5","method":"setLibraryDebuggable","params":{"isolateId":"isolates/360410364","libraryId":"libraries/0","isDebuggable":false}}
==> {"id":"6","method":"setLibraryDebuggable","params":{"isolateId":"isolates/360410364","libraryId":"libraries/1","isDebuggable":false}}
==> {"id":"7","method":"setLibraryDebuggable","params":{"isolateId":"isolates/360410364","libraryId":"libraries/2","isDebuggable":false}}
==> {"id":"8","method":"setLibraryDebuggable","params":{"isolateId":"isolates/360410364","libraryId":"libraries/3","isDebuggable":false}}
// SNIP
<== {"jsonrpc":"2.0", "result":{"type":"Success"},"id":"5"}
<== {"jsonrpc":"2.0", "result":{"type":"Success"},"id":"6"}
<== {"jsonrpc":"2.0", "result":{"type":"Success"},"id":"7"}
<== {"jsonrpc":"2.0", "result":{"type":"Success"},"id":"8"}
// SNIP

However, it doesn't seem to do what I expect. Here's my sample program:

main() {
  print("Danny");
}

I have a breakpoint on line 2 and I'm pressing Step Into after it's hit. I end up in broken inside print, but I expected it to just step over.

@DanTup
Copy link
Collaborator Author

DanTup commented Sep 16, 2016

FYI @johnmccutchan

@johnmccutchan
Copy link
Contributor

@mhausner @turnidge

@mhausner
Copy link
Contributor

I can reproduce this using the Observatory debugger. This is a bug in the VM. The VM side of the debugger ignores the "isDebuggable" property of libraries and thus pauses even in libraries that are marked as not debuggable.

This is a relic from a time when the VM supported two debuggers.

@turnidge wants to think about how to fix this the right way.

@mhausner
Copy link
Contributor

The culprit is in this code:

bool Debugger::IsDebuggable(const Function& func) {
  if (!func.is_debuggable()) {
    return false;
  }
  if (ServiceIsolate::IsRunning()) {
    return true;  <<<<<<<<<
  }
  const Class& cls = Class::Handle(func.Owner());
  const Library& lib = Library::Handle(cls.library());
  return lib.IsDebuggable();
}

@kasperl kasperl added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

5 participants