-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
See values in dec or hex in the debugger #28025
Comments
I really want to view hex values too. Seems like a small thing to add to the otherwise very good VSCode. |
I suggest to raise this request against the debugger extension you are using since the format of values id provided by the extension. VS Code does not have generic support for value formats. |
I use gdb as debugger and there are commands for gdb to view variables as hex but how do I set-up VSCode to use those commands? |
As a said in my previous comment: VS Code does not have generic support for value formatting (e.g. to view variables in hex). This functionality must come from the debug extension that you are using. |
I think it would be crazy to have to implement this over and over in every debugger! |
The debugger frontend knows nothing about data types like integers, floats, or doubles. It only shows strings and leaves the formatting of these strings to the backend. We've made this "crazy" design decision to keep the Debug Adapter Protocol simple. |
I keep this issue open because I see a need for a customisable debugger frontend UI for changing the format of values/variables. This UI could be similar to the "exception" configuration options in the breakpoints view. The backend (Debug Adapter) could provide a set of labels (and IDs) which are shown in the debugger UI without interpretation (e.g. as a context menu action on a variable). The IDs are passed back to the Debug Adapter and determine how values are formatted. |
Thanks for looking at this again. VS Code is great because it does less rather than more and leaves a lot to plug-ins. I think this is a case VS Code to step up and implement this feature. The simple way CS Code works made me expect to have a prefix or post-fix to the variable name to implement this. |
Just to be clear: my proposal from above does not suggest to let VS Code do the formatting (because it can not). It just proposes to make it easy for debug adapters to get their formatting implementation behind some VS Code provided UI. |
I have no idea how vs code works behind the scenes and as long as we get a uniform way to format the contents of variables the detail is not critical. I have never seen an IDE that is as flexible as I would like. I would like to be able to select on a per variable basis one or more display formats. So I could have my_byte and it shows "255 0xFF" |
Hi @weinand , By checking the vscode debug protocol, I found this:
This comes with a VariablesRequest. So the debug client can actually tell the adapter to show values in hex format. We are trying to respond to this option. But I cannot find the UI entry to turn that on. Is this still work in progress or can you share more background on this? |
Yes, these format options are not yet surfaced in VS Code (but they probably are in VS). That's the reason for my comment from above:
|
Thank you for the info. Then we are in the right direction. Inside the adapter, we support formatting options such as showing integers in hex format. |
I am not sure if it works previously in VS Code, but in VS Code version 1.19.1 and in VS, you can use postfixes in Watch window to show numbers in hex format, for example: |
Even a global setting for hex display in the (mouse hovering) object inspector is very helpful. |
another work around.... cast to void* eg "(void*)myinteger" |
i need this feature, pls dev it |
A debugger front-end that works "only with strings" could support a feature that recognizes which strings can be parsed as decimal numbers and optionally prints a hexadecimal representation next to or instead of the decimal string. A front-end does not need to be told types or anything by a back-end to recognize and convert common formats. |
any update? |
Nice trick. Works because of gdb's
That's a https://github.com/microsoft/vscode-cpptools specific feature inspired by VS. |
Since VS Code 1.50 we have added functionality that enables debug extensions to implement data formats for variables:
|
Hello! |
@yaNePonedelnik Debug extensions must support this. I suggest to file feature requests against the debug extensions you are using. |
@weinand Thank you for your reply |
I'd like to be able to select in which format I see the values of local and watched variables in the debugger. It would be preferred to have a generic setting but be able to change it per variable.
The way that it is now I often need to use a exteral dec-to-hex converter and copy the values from VS Code. Being able to see them in hex directly in the debugger would be a great help!
I mostly debug C/C++ programs but I imagine that this is generic for all languages.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: