Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing the expression result in hexadecimal format using visual studio's trace points

Does anybody know, whether it's possible to output the values in a hexadecimal via the visual studio's trace points?

Thanks!

like image 465
Maksim Skurydzin Avatar asked Oct 10 '11 13:10

Maksim Skurydzin


People also ask

What is trace point in Visual Studio?

Tracepoint is an awesome feature of Visual Studio and it is available since Visual Studio 2005. It allows you to write the values in output window without even stopping at any point or you can stop it after the loop and see how the loop progressed based on your needs.

What is a trace point?

The trace command defines a tracepoint, which is a point in the target program where the debugger will briefly stop, collect some data, and then allow the program to continue.

How do you use Tracepoint?

Set tracepoints in source code You can set tracepoints by specifying an output string under the Action checkbox in the Breakpoint Settings window. To initialize a tracepoint, first click on the gutter to the left of the line number where you want to set the tracepoint.

Which of the following are windows that appear during the debug context in Visual Studio Express?

The Autos and Locals windows show variable values while you are debugging. The windows are only available during a debugging session. The Autos window shows variables used around the current breakpoint.


1 Answers

I have recently found out, how this can be done. Visual studio provides a way to specify the format we want to see the expression in the watch/immediate windows. You can do the following:

foo, x

This will display the foo variable in the hexadecimal format regardless of whether the hex or dec displayed is globally enabled in VS. You can also specify lots of other display formats. The full list can be found there http://msdn.microsoft.com/en-us/library/75w45ekt.aspx.

This feature also works with trace points, which is very useful when you want the values to appear in hexadecimal format in output window.

{bar,x}
like image 199
Maksim Skurydzin Avatar answered Oct 16 '22 22:10

Maksim Skurydzin