Watch Expression Type Modifiers

Debug ›› Debug Windows ›› Watch Window ››
Parent Previous Next

winIDEA will display high level variable values formatted according to their type. If you wish to override default formatting or to enforce a type to a typeless expression, you can use type modifiers.

A type modifier is a comma followed by a set of characters after the expression:

<expression>,<type modifier>


this can also be selected via 'Format' command in context menu:



Following type modifiers are available:

Character

Action

c

force 8 bit signed integer type

z

force 8 bit unsigned integer type

i

force 16 bit signed integer type

w

force 16 bit unsigned integer type

l

force 32 bit signed integer type

u

force 32 bit unsigned integer type

ll

force 64 bit signed integer type

ull

force 64 bit unsigned integer type

f

force 32 bit float type

e

force 64 bit float type

s

force string interpretation

a

force array interpretation

d

decimal formatting

x or h

hexadecimal formatting

b

binary formatting

m

hexadecimal dump

UTF16

UTF-16 formatting

r

display struct member names

<number>

repeat <number> times

If the watch window should display a number and the read information is not a number (for example infinity), the display will show NAN (Not A Number).



Example 1:

:0x1000,I        ->        7281        

displays locations 0x1000-0x1001 as a signed 16-bit integer.


:0x1000,F2        ->        (4.01,3.14)

displays locations 0x1000-0x1007 as an array of two 32-bit floats.


structure,rx        ->        (a:0x3,y:0x55)

displays variable 'structure', showing member names and their values formatted hexadecimal.


largearray,a500

displays the array 'largearray', starting from the 500th element in the array. This enables watching arrays greater than 256 bytes.


Example 2:

If your program looks like:

void ZeroBuf(int nBufCount, char * pcBuf)

{

 for (int I=0; I<nBufCount, I++)

   *pcBuf++=0;

}

then watches like this will show:

nBufCount,d    the value of nBufCount in decimal

pcBuf          the address that the pcBuf points at

*pcBuf         the character at location that the pcBuf points at    


Example 3:

When trying to monitor SP content, it is very convenient to monitor it in the watch window.

To monitor SP content, use following syntax in the watch pane:

:(@SP-8),8m        displays 8 bytes down from current SP

:(@SP),6m        displays 6 bytes up from current SP

When using standard memory window to monitor the SP, the user has to enter the physical address where the SP points to.


more:

ANSI C printf syntax

Display of char type arrays