Question

Every time a watchpoint is modified GDB will print the old value and the new value. However, sometimes I don't want to print the value in the default decimal integer format: for instance, if I'm watching *(unsigned*)$ebp to debug a possible stack overflow (wow, SO...), the value is nonsense unless displayed in hexadecimal format (like p/x when printing something).

Is it possible to set the display format for a particular watchpoint? Thanks.

Was it helpful?

Solution

Is it possible to set the display format for a particular watchpoint?

If you want the watchpoint to print in hex, set it as watch of a pointer, e.g.

watch *(char**)$ebp     or
watch *(void**)$ebp

OTHER TIPS

set output-radix 16

Please refer to this answer How to make gdb print out all values in hexadecimal mode? You can set all types of prints happening due to gdb (may it be because of breakpoints, watchpoints, or your custom prints) will have hex-format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top