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

[debug] Source.adapterData is not preserved across debug sessions #34511

Closed
vadimcn opened this issue Sep 16, 2017 · 17 comments
Closed

[debug] Source.adapterData is not preserved across debug sessions #34511

vadimcn opened this issue Sep 16, 2017 · 17 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster verification-found Issue verification failed verified Verification succeeded
Milestone

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Sep 16, 2017

  • VSCode Version: 1.16.1
  • OS Version: All

The StackFrame.source.adapterData attribute that adapter sends to the client, does not round-trip to SetBreakpointsArguments.source.adapterData across debug sessions. However, protocol documentation states that it should be preserved (or at least that's how I read it).

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Sep 16, 2017
@isidorn
Copy link
Contributor

isidorn commented Sep 18, 2017

@vadimcn my assumption is that here we do not find a source so we just create a new object. Can you set a breakpoint and verify is that is happening?

In order to reproduce this issue on my machine better, can you clarify your steps? Can you reproduce this only if debugging is stopped and started again - thus you mention across debug sessions?
Also can you reproduce with latest insiders as @weinand has improved how we handle source uris.

@isidorn isidorn added info-needed Issue requires more information from poster and removed new release labels Sep 18, 2017
@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 18, 2017

my assumption is that here we do not find a source so we just create a new object. Can you set a breakpoint and verify is that is happening?

Yes, that's what seems to be happening.

In order to reproduce this issue on my machine better, can you clarify your steps?

So I'm allowing to set breakpoints in generated sources (disassembly). In order to reconstitute breakpoints across debug sessions, I need to remember how source lines mapped to addresses. I was trying to stash this info into 'adapterData', but it gets preserved only during debug session. If I stop and restart debugging, it is lost.

Also can you reproduce with latest insiders as @weinand has improved how we handle source uris.

No, insiders build does not seem to be better in this respect.

@isidorn isidorn added this to the September 2017 milestone Sep 19, 2017
@isidorn
Copy link
Contributor

isidorn commented Sep 22, 2017

@vadimcn thanks for reporting this. There was an issue that we were not preserving adapterData across sessions, due to the lifecycle of a session on our end. Now we tie the adapterData to the breakpoint, so it should survive between sessions.
Please try out the insiders from Monday and let us know if the issue is fixed for you. Thank you

@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Sep 22, 2017
@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 25, 2017

@isidorn: This still isn't working in 9/25 insiders build.

@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 26, 2017

@isidorn: I did install an upgrade yesterday and Help/About said "Date 2017-09-25...".

Installed another update today... looks like something got broken, because adapterData is no longer preserved even within the same debug session for setBreakpoints (for source request it is preserved).

Help/About:

Version 1.17.0-insider
Commit a5210bcbda97166904ce4c08ee296cb98fccfcd9
Date 2017-09-26T05:15:18.286Z
Shell 1.7.7
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

@isidorn
Copy link
Contributor

isidorn commented Sep 27, 2017

@vadimcn thanks for letting me know, reopening to investigate

@isidorn isidorn reopened this Sep 27, 2017
@isidorn
Copy link
Contributor

isidorn commented Sep 27, 2017

@vadimcn pushed a fix, please try it out in tomorrows insiders (not yet out). What os are you using, so I know what link to give you

@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 27, 2017

I'm on a 64 bit Ubuntu

@isidorn
Copy link
Contributor

isidorn commented Sep 28, 2017

@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 28, 2017

@isidorn: Nope, adapterData still does not survive across debug sessions.
The path property does persist though. Maybe I could encode my data there? Can path be a URI?

@weinand
Copy link
Contributor

weinand commented Sep 28, 2017

@vadimcn Yes, in the Insiders a "Source.path" can be a URI.

@weinand weinand added the verification-found Issue verification failed label Sep 29, 2017
@weinand weinand reopened this Sep 29, 2017
@weinand weinand modified the milestones: September 2017, October 2017 Sep 29, 2017
@weinand
Copy link
Contributor

weinand commented Sep 29, 2017

@vadimcn please provide some details about where the adapterData is lost.

@weinand weinand added the info-needed Issue requires more information from poster label Sep 29, 2017
@vadimcn
Copy link
Contributor Author

vadimcn commented Sep 29, 2017

It seems that adapterData is lost when the debug session ends:

  • I emit adapterData (along with name and sourceReference) when responding to stackTrace request.
  • I get it back when VSCode requests source for that stack frame.
  • I get it back in setBreakpoints request when I set a breakpoint in that source file.
  • However, I don't get it back after stopping and re-starting debugging. The source field in setBreakpoints request contains just name and path from the previous session (path being equal to name, btw, which is a bit strange).

@isidorn
Copy link
Contributor

isidorn commented Oct 5, 2017

@vadimcn thanks for providing more details.
Currently the adapterData lacks a bit of documentatoin. It was intended only to be used with source that lives in a breakpoint and the implemention follows this.
In order for the adapterData to be stored across seasion you would need send that adapterData to a source that is tied to a breakpoint.
You can do this using a Breakpoint 'changed' event, or simply by responding to the intial breakpoint request with the correct source with the adapter data.

If you simply tie the adapter data to the source it will not be persisted due to the different lifecycle of a breakpoint and a source on the implementation side.

I understand this might be a bit complex, so as an alterantive you could also encode this data in the uri.

@isidorn isidorn closed this as completed Oct 5, 2017
@vadimcn
Copy link
Contributor Author

vadimcn commented Oct 6, 2017

@isidorn: Are the sources stored with breakpoints completely separate from sources VSCode stores for files? Will it try to re-associate them? If so, which attribute will be used to group them together?

@isidorn
Copy link
Contributor

isidorn commented Oct 9, 2017

@vadimcn it will try to reasociate them, we always use uri as an identifier. And here is how we contruct the uri for an internal debug source https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/debug/common/debugSource.ts#L28

We do not store the whole source object with the breakpoint, nor do we store the source object anywhere since their lifecycle is the same as the lifecycle of a debug session, so they always come new when a debug session starts. We only store the adapterData with the breakopint which is a bit ugly imho.

@roblourens roblourens added the verified Verification succeeded label Nov 1, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster verification-found Issue verification failed verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants