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

Variables are not displayed when debugging two sessions and one ends #113742

Closed
yannickowow opened this issue Jan 4, 2021 · 12 comments · Fixed by #131016
Closed

Variables are not displayed when debugging two sessions and one ends #113742

yannickowow opened this issue Jan 4, 2021 · 12 comments · Fixed by #131016
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@yannickowow
Copy link
Contributor

yannickowow commented Jan 4, 2021

Hi,
First of all, Happy new Year!
I submit here an issue regarding to Variables in Debug View.

  • VSCode Version: Latest (1.52.1)
  • OS Version: Win10 x64

Steps to Reproduce:

  1. Launch a Debug Configuration 1 (my case is from a custom DebugAdapter, this problem occurs as well with C/C++ Extension)
  2. Launch a second Debug Configuration (it can be a different type from previous one)
  3. End a session (Stop or Step)
  4. Second session has now focus but variables are not revealed.

Variables are correctly displayed when switching one session to another, but they are not displayed after a session ended.
Regards.

EDIT: If you try the same steps with 3 sessions:

  1. First, you will see that your current session does not display variables.
  2. If you switch to the 3rd session, it will display variables associated.
  3. If you switch again, it will show you variables associated.

Does this issue occur when all extensions are disabled?: N/A : Need at least one extension to debug.

EDIT2: This ""problem"" is due to stackFrame lost focus, which happens when debuggee stops. It can be an expected behaviour. If so, I can close this issue.

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 5, 2021
@weinand weinand removed their assignment Jan 5, 2021
@isidorn
Copy link
Contributor

isidorn commented Jan 5, 2021

Happy New Year,

Yes I can reproduce this with js-debug adapter which has child sessions. The issue is that when a debug session is stopped we do not focus the stack frame, but only the session. What this means is that the variables does not display anything since a stack frame is not focused.
I acknowledge that this is a bug. And I think @connor4312 might have hit something similiar in the past

@isidorn isidorn added the bug Issue identified by VS Code Team member as probable bug label Jan 5, 2021
@isidorn isidorn added this to the On Deck milestone Jan 5, 2021
@weinand weinand modified the milestones: On Deck, August 2021 Aug 4, 2021
@isidorn
Copy link
Contributor

isidorn commented Aug 4, 2021

@yannickowow just to check if you can still reproduce this with latest vscode insiders? Since we have improved automatic switching of focus of sessions?

@yannickowow
Copy link
Contributor Author

yannickowow commented Aug 4, 2021

Using

Version: 1.59.0-insider
Commit: 8f58c1f457bd2ddf6cf81120c450c783b6e8c01b
Date: 2021-08-04T08:40:59.207Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Linux x64 4.19.0-14-amd64

I can still reproduce this issue.
When a session is closed, no current session takes the focus. It does not show variables nor the arrow in the glyph margin.

lab2-1628106008472.mp4

@isidorn
Copy link
Contributor

isidorn commented Aug 11, 2021

@yannickowow this works just fine for me with js-debug and latest Insiders. Here's a gif where I am doing the same thing as you.
In case you can still reproduce this, can you please F1 > developer tools > sources and place a breakpoint here and let me know what you see? Since that code should handle this case exactly.

recording (2)

@isidorn isidorn added the info-needed Issue requires more information from poster label Aug 11, 2021
@isidorn isidorn removed this from the August 2021 milestone Aug 11, 2021
@yannickowow
Copy link
Contributor Author

yannickowow commented Aug 14, 2021

I used latest version of Insiders (and Code OSS) and it is not working.
Sadly, it reveals a new bug when I do stepping using multi session :(

For the current bug, I hope it is still the line you asked.
This breakpoint is only triggered when I close the second session and not the first one.
image

I did try by changing the test in line 661 by this line

if (this.model.getSessions().length <= 1) {

image

@isidorn isidorn added this to the August 2021 milestone Aug 16, 2021
@isidorn
Copy link
Contributor

isidorn commented Aug 16, 2021

Now I pushed the fix for the new issue you found. It would be great if you can re-try tomorrow with vscode insiders and try to investigate more. The actual line is this one

if (focusedSession && focusedSession.getId() === session.getId()) {

This is a permalink, so the line should be definite. Just try to figure out how the focus behaves, and if the focus is properly passed to the remaining session. Thanks

@isidorn isidorn removed this from the August 2021 milestone Aug 16, 2021
@yannickowow
Copy link
Contributor Author

yannickowow commented Aug 17, 2021

I did some testing, here is my understanding.
It looks like informations gathered from this line is correct, and the needed session is correctly focused. It returns a correct session (which the first one available) and defines the session which will capture stepping commands and console.

However, we are setting a focus on a session which is not able to focus to a given stackFrame / thread couple.
I tried by getting all the objects returned by getStackFrameThreadAndSessionToFocus and it behaves as we want here.

Before:

const { session } = getStackFrameThreadAndSessionToFocus(this.model, undefined, undefined, undefined, focusedSession);
this.viewModel.setFocus(undefined, undefined, session, false);

After:

const { session, thread, stackFrame } = getStackFrameThreadAndSessionToFocus(this.model, undefined, undefined, undefined, focusedSession);
this.viewModel.setFocus(stackFrame, thread, session, false);

With further testing, to display these variables we only need to focus a stackFrame. Focusing a thread is a plus.

Here is a record with the after code

HAMITI_YANIS_RenduCrypto_1_-1629203782288.mp4

@isidorn
Copy link
Contributor

isidorn commented Aug 17, 2021

@yannickowow that looks like a reasonable change. Would you like to create a PR with that change, or would you like me to push it?
Thanks a lot for a great investigation 👏

@yannickowow
Copy link
Contributor Author

I opened a PR about this change

@isidorn isidorn added this to the August 2021 milestone Aug 17, 2021
isidorn pushed a commit that referenced this issue Aug 17, 2021
- When a session ends, it should focus another session and correctly display variables
- Here, focus the first session and the Thread 1
- Should display variables accordingly

Fix #113742
isidorn added a commit that referenced this issue Aug 17, 2021
[debugService #113742] variable display on debug session ending
@isidorn isidorn removed the info-needed Issue requires more information from poster label Aug 17, 2021
@isidorn
Copy link
Contributor

isidorn commented Aug 17, 2021

Awesome. I merged it. Should be in insiders tomorrow. Let me know how it goes once you try it out with the built vs code.

@yannickowow
Copy link
Contributor Author

👍

@isidorn
Copy link
Contributor

isidorn commented Aug 19, 2021

Great, adding verified label.

@isidorn isidorn added the verified Verification succeeded label Aug 19, 2021
AiverReaver pushed a commit to AiverReaver/vscode that referenced this issue Aug 19, 2021
- When a session ends, it should focus another session and correctly display variables
- Here, focus the first session and the Thread 1
- Should display variables accordingly

Fix microsoft#113742
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2021
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 insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@weinand @isidorn @yannickowow and others