Search code examples
gdb

How can I print in binary mode in GDB?


I tried b, but it seems not to work:

(gdb) p/b 0x0000000000400398
Size letters are meaningless in "print" command.

Is there such a switch?


Solution

  • You need the /t switch which works with both p and x:

    (gdb) p /t 0x0000000000400398
    $1 = 10000000000001110011000
    

    See help x for more info on the FMT (format) switches.