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

UI doesn't indicate each thread listed in the call stack as having been "PAUSED ON EXCEPTION" on loading core dump #165032

Closed
ayushsahay1837 opened this issue Oct 31, 2022 · 8 comments · Fixed by #165180
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

@ayushsahay1837
Copy link

Version of VS Code: 1.67.2

OS: Ubuntu 18.04.6 LTS

Reproducible steps that cause the issue:

Have Visual Studio Code load a core dump in lldb via lldb-vscode (debug adapter for Visual Studio Code available as part of the LLDB project, which, to the best of my knowledge, is unpublished) by employing an attach configuration akin to the following –

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Post-mortem Debug",
            "type": "lldb-vscode",
            "request": "attach",
            "program": "${workspaceFolder}/a.out",
            "coreFile": "${workspaceFolder}/a.out.core"
        }
    ]
}

What I expect to see, versus what I actually see:

All threads in the process are stopped with reason exception

...

{"body":{"allThreadsStopped":true,"preserveFocusHint":false,"reason":"exception","threadCausedFocus":true,"threadId":848},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":843},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":844},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":845},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":846},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":847},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":849},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":850},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":851},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":852},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":853},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":854},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":855},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":856},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1881},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1882},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1883},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1884},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1886},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1887},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1888},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1889},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":true,"preserveFocusHint":true,"reason":"exception","threadId":1890},"event":"stopped","seq":0,"type":"event"}

...

So, I'd expect the UI to indicate each thread listed in the call stack as having been PAUSED ON EXCEPTION. However, I see that the UI indicates only Thread # 23 as having been PAUSED ON EXCEPTION, and others as having been PAUSED

AllThreadsStoppedTrue

What's curious, though, is that if allThreadsStopped is reported as false in each of the pertinent stopped events, then the UI indicates all threads in the call stack as having been PAUSED ON EXCEPTION

...

{"body":{"allThreadsStopped":false,"preserveFocusHint":false,"reason":"exception","threadCausedFocus":true,"threadId":848},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":843},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":844},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":845},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":846},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":847},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":849},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":850},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":851},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":852},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":853},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":854},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":855},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":856},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1881},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1882},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1883},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1884},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1886},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1887},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1888},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1889},"event":"stopped","seq":0,"type":"event"}

{"body":{"allThreadsStopped":false,"preserveFocusHint":true,"reason":"exception","threadId":1890},"event":"stopped","seq":0,"type":"event"}

...

AllThreadsStoppedFalse

Kindly let me know in case any additional information is required.

@roblourens
Copy link
Member

roblourens commented Nov 1, 2022

Initial investigation shows that this is from

thread.stoppedDetails = thread.threadId === stoppedDetails.threadId ? stoppedDetails : { reason: undefined };

I think it essentially clears the previous pause reason when processing the allThreadsStopped. I think this could keep the previous stoppedDetails on the thread. But, isn't it odd to send allThreadsStopped if you are going to send individual stopped events for every thread anyway?

Kinda related to #70107

@roblourens roblourens added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Nov 1, 2022
@roblourens roblourens added this to the Backlog milestone Nov 1, 2022
@ayushsahay1837
Copy link
Author

@roblourens, I imagine that that's an implication of the design. Currently, LLDB supports only process-centric debugging. So, when any thread in a process stops, all the other threads are stopped too. I reckon that that's why lldb-vscode reports allThreadsStopped as true for every stopped event. However, AFAICT, lldb-vscode maintains neither a list nor the states of the processes and threads under debug, and relies on pertinent events broadcast by LLDB to report stopped events. Now, if I'm not wrong, then all the threads in a core dump are stopped. So, I'd expect LLDB to broadcast a pertinent event for each thread in a core dump, and lldb-vscode to consequently report stopped events for all the threads.

@roblourens
Copy link
Member

Sure, that's fine. Seems correct for vscode to support this the way you're using it.

@ayushsahay1837
Copy link
Author

@roblourens, thanks! 😁

BTW, is it too early for any work on this to be planned for a specific release? I only ask so that I can offer our customers a ballpark estimate of when they can expect the fix for this to become available. 😬

@roblourens
Copy link
Member

How does next month sound? 😄

@roblourens
Copy link
Member

And once the PR above is merged, and we have resumed shipping new Insiders after this week's release (should be by the end of the week, or next Monday), I'd appreciate you verifying that the issue is actually fixed

@ayushsahay1837
Copy link
Author

@roblourens, sure, I'd be happy to! Thanks a lot for looking into this! 😁

roblourens added a commit that referenced this issue Nov 2, 2022
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Nov 2, 2022
@ayushsahay1837
Copy link
Author

@roblourens, the UI indicates each thread listed in the call stack as having been PAUSED ON EXCEPTION in the latest release of Visual Studio Code Insiders.

AllThreadsStoppedTrueFixed

@connor4312 connor4312 added the verified Verification succeeded label Dec 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2022
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
4 participants