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
Feature Request: Show function return value in the debugger #3214
Comments
I also think you should be able to see the return value of a function by hovering it, just like in Visual Studio. |
Imo this is pretty basic and pretty important. I wonder why so few people miss this... |
Why not implement this feature since gdb supports to inspector the return value from a function. |
Should be shown in the variables view after exiting or stepping over a function, just like in VS. |
@Trass3r no, VS Code's new JavaScript debugger shows return values without DAP support: |
Apparently this commit. |
@connor4312 VS Code should not use private protocol. If DAP is not sufficient to support showing return values, please create a DAP feature request. @Trass3r you are invited to file a feature request for whatever you want to add to the DAP. |
@weinand js-debug doesn't use anything private/special in DAP. We just return a variable that we name "Return value."
js-debug will show the return value whenever it's present in the information we get from the runtime. This happens right after you step over a "return" statement, before the function is popped from the stack (though if you're running with sourcemaps, this location can be obscured; tooling seems to be somewhat inconsistent in mapping the whitespace range after return statements) I agree that this is something that can and should be handled adapter side. We do some fairly advanced things with the return values in js-debug (e.g. allowing them to be used in watch expressions and the repl) and I never ran into a limitation imposed by the DAP. |
@connor4312 thanks for your confirmation that you are not using private protocol! :-) |
Interesting read: https://stackoverflow.com/questions/267674/how-to-inspect-the-return-value-of-a-function-in-gdb |
Indeed the stopped event after stepping out contains the return value:
|
I got a prototype of the functionality when stepping out. It is indeed a pure adapter change. |
Not sure when this changed, but I now see
in the local variables. Thank you! |
Yeah fixed in microsoft/MIEngine#1036, but only when stepping out, not over. |
Hello, what if it's a native function? Vscode debugging cannot go inside native functions. Example: |
Would it be possible to show the last function return value somewhere in the debugger window - preferrably variables?
I know it's possible to get at using gdb commands, but it's fairly convoluted. Not sure how difficult it is on Windows though?
The text was updated successfully, but these errors were encountered: