Comments (14)
Yes, this is a bug on the VSCode side. The issue seems to be that we only show the thread in the call stack once a stopped event has happened for that thread.
I can fix the issue but it requires testing so I propose to do it after connect event.
from vscode.
After investigating this a bit further, I have some more questions:
- Do you send a 'thread' event (with the reason 'started') once a new thread gets created in your adapter. This event notifies VSCode that there is a new thread and in the mono case I can see new threads even though no breakpoints got hit on those threads
- The current implemenation will only call the stackTrace request for the stopped thread, not for all the threads, which I believe is correct behavior. If you stop on Thread A I do not think it is necessery to check the state of thread B, since you have to report first that something changed in B
Let me know what you think
from vscode.
Assigning to @lukehoban so he reads my comment
from vscode.
Sorry - missed your reply earlier.
Do you send a 'thread' event (with the reason 'started') once a new thread gets created in your adapter. This event notifies VSCode that there is a new thread and in the mono case I can see new threads even though no breakpoints got hit on those threads
No, I don't do this yet, and that is likely the root problem. I see how this is done in the Mono debugger and that makes sense.
Unfortunately, this won't map as easily to the Go debugger as it does in the Mono case. The Delve debugger does not provide any events, only host-initiated RPC commands. I think that's reasonably common for a class of debuggers primarily used through a command line interface.
So to implement this, we will need to get all the threads and compute which are new or stopped to send the events. It feels like the vscode debugger could just be doing that itself since we already provide the ability to list threads.
Is there any reason why you need these events vs. just computing the threads to show based on the ThreadsRequest
, just as you do for scopes
and variables
today (I don't need to fire an event to tell you that the scope changed or that new variables were introduced to a scope)?
The current implemenation will only call the stackTrace request for the stopped thread, not for all the threads, which I believe is correct behavior. If you stop on Thread A I do not think it is necessery to check the state of thread B, since you have to report first that something changed in B
Okay - that makes sense. I think I was just confused because I was seeing multiple threads show stack traces at once in some cases - but probably that was because of not sending the right thread events.
from vscode.
Yes I could do something like you proposed.
@weinand what is your take on this. Should we change how we handle threads in the protocol so we support more adapters?
from vscode.
What I am seeing, is that upon hitting a breakpoint, the adaptor must report all threads in the process as stopped, otherwise vscode seems to think they are still running and won't display their callstacks.
Which may be fine, if you are planning to support something like gdb's 'non-stop' mode, but I feel this behavior could be better documented, 'cause I had to discover it via trial and error.
from vscode.
Oh, and if I report stops for all threads, the debugger UI seems to select which one to display as current randomly, which can lead to confusion as to which thread has caused the stop.
I've tried varying the order in which StoppedEvent's are sent, but that doesn't seem to change anything.
from vscode.
@vadimcn thanks for the feedback! We are aware of some of the issues you mentioned. Currently we are looking into improving/fixing issues around our thread architecture and this will probably be improved for our January release. Will keep you updated.
from vscode.
Any updates? The next release is nigh, but I am still seeing the same issues with threads display.
from vscode.
Unfortunately, this has not been tackled for January. We will look into improving our thread model in our February release.
Sorry about this.
from vscode.
Oh, and if I report stops for all threads, the debugger UI seems to select which one to display as current randomly, which can lead to confusion as to which thread has caused the stop.
I've tried varying the order in which StoppedEvent's are sent, but that doesn't seem to change anything.
Yes, I'm finding the same issue with my debugger extension. It's making multi-threaded debugging painful with the UI jumping to different sources on each break.
FWIW, I would prefer it if StoppedEvent
could take an array of { threadId, reason } entries and use the first as the callstack display priority.
from vscode.
And it would be nice if the threads display prioritised stopped threads over running threads in the order it displays them. I'm finding that on a lot of occasions, the thread that has stopped is the last created thread - which puts it at the bottom of the list requiring the user to scroll down to it.
from vscode.
@adelphes, I have not seen this issue for many months. VSCode displays the correct thread as long as you pass its id in the stop event.
from vscode.
Closing as this issue is ancient, let's keep the discussion here #19858
from vscode.
Related Issues (20)
- Javascript file curropted HOT 1
- Javascript file curropted HOT 2
- Performace Issues coding C# using C# Dev Kit HOT 2
- Contributing [Bulid & Run from Source]
- Autocompleted not working properly HOT 2
- Explore Notebook formatting via Code Actions HOT 1
- White Flash Opening Visual studio Code
- Flash Opening Issue Reporter
- Input variables in launch.json are ignored in favour of those in tasks.json
- File timeline history is permanately loss when a file is renamed to delete file HOT 4
- crash on type rename HOT 1
- crash on type rename HOT 3
- Clarify documentation of `editor.suggest.replaceMode`
- Bug free HOT 1
- Feature Ask HOT 2
- Post exit update attempt abends if another user has VSCode open on the same machine. HOT 1
- The JS/TS language service immediately crashed 5 times
- ignore HOT 1
- Explorer hides HOT 1
- Can't find "Copy to Clipboard" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode.