-
Notifications
You must be signed in to change notification settings - Fork 240
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 to view variables as different types #58
Comments
The peripheral and core register views already have the ability to set formatting (right click on the node and you will get an option to change the format). Unfortunately the presentation of the variables in the main variable view are controlled by VS Code itself, so I have limited ability to control how it is presented, I only supply the raw data to VS Code through an existing interface, it decides how to present those. I may be able to make some tweaks but I'll need to research. As for arrays, if the variable is a statically sized array (e.g. if it was declared as int[10]) it should already allow you to see each element. For pointer based ones it won't know the size, and again as a result of not controlling the presentation I cannot currently change the presentation to my knowledge. I will do some research into this area of the VS Code API to see if there is anything I can take advantage of - but may not currently be possible for me to do this. |
@Marus it seems that VSCode has API for that: interface Capabilities {
...
/** The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest. */
supportsValueFormattingOptions?: boolean;
...
} |
I was looking to see if there were any existing issues for VSCode this one suggests it can be accomplished in the debugger microsoft/vscode#28025. Interestingly the last comment suggests you can use "variable,h" to display the variable as hex in a watch window. Which could be a workaround for now. In eclipse you enter the length of the array to display, maybe we could open another tab like the current memory view does? Although having it in the variable list would be preferable. |
I'll take a look at the interface that Ivan pointed out; that may give us what we are looking for, at least in the watch view. Have to see exactly what the capabilities are as I hadn't come across that on before. I don't really like the idea of opening a new tab like the memory dump does for this, as it's confusing to have variable views presented in different places. Will take a look at what is available through the API Ivan pointed out, and perhaps make requests to the VS Code team for where I would like to see expansions to the VS Code APIs for what isn't currently possible. |
I recently found I can make this work by adding a line like this as an expression in the watch window.
I believe this is GDB specific syntax? Anyway it works perfectly for what I need. Only thing that would be nicer is to have a dialog with options if you right click on a pointer, but typing the expression in isn't too hard. |
Another option is to set the GDB radix using the debug-console: Now all watch windows are in hexadecimal. |
So is it ever planned to add this option natively to Cortex-Debug? |
I don't think VSCode actually supports Without help from VSCode, I don't think this is possible. @Marus did add formatting options for watch expressions in the form of b: 'binary',
d: 'decimal',
h: 'hexadecimal',
o: 'octal',
n: 'natural',
x: 'hexadecimal' |
Yup, no support for it in VSCode. Got confirmation. See link below microsoft/VSDebugAdapterHost#10 @microwavesafe I think we should close this issue. I am trying to track/fix all open ones. |
Would it be possible to add the ability to view the variables as different types? Working with hardware means viewing the variables as hex and even binary can be really useful. Pointers are converted to hex and ASCII is shown next to bytes, so I guess it's possible?
Also array pointers only show up as a single value, again it would be very useful if you can choose to display these as an array. Usually you are asked to enter the size of the array, then it just displays that area of memory as the variable.
The text was updated successfully, but these errors were encountered: