Watch-window expressions
Generate paste-ready watch expressions for Visual Studio, VS Code, or GDB / LLDB. Enter your fixed-point variable names, pick a Word width and Q-factor (or E), and copy the generated block into your debugger's watch panel — each variable then displays as its real-valued (float) interpretation while paused.
What you get
- Fixed → Float: each variable becomes
varname / 2Q.0so the watch panel shows the real-valued interpretation of a Qn integer. - Float → Fixed: each variable becomes a cast
expression
(intN_t)((varname) · 2Q)with a half-away-from-zero rounding term, so the watch panel shows the bit pattern that would be stored in your fixed-point port. - Hex sibling (optional): adds a second line per
variable that uses the debugger's hex format specifier
(
,xin Visual Studio,/xin GDB) so you can see the raw two's-complement representation alongside.
Notes per debugger
- Visual Studio: paste each line into a separate
slot in the Watch panel. Format specifiers like
,g(general float),,d(decimal int),,x(hex) follow a comma at the end. - VS Code (cppdbg): same expression syntax as
Visual Studio. Add via "+ Watch" or paste into
launch.jsonunder"watch". - GDB / LLDB: use as
display var/2^Qorwatch var; for explicit hex useprint/x var.