The 'x' command: size problem

Vladimir Prus ghost@cs.msu.su
Tue Sep 6 15:04:00 GMT 2005


Hello!

Suppose I want to print, in binary, content of some large object (for
example, network packet header).

I can use this:

   x /154 &packet

Assuming 154 is the size of the object, but neither:

   x /sizeof(packet) &packet

nor

   set $size = sizeof(packet)
   x /$size &packet

works. In fact, the x_command function in printcmd.c expects the the size
argument be always given as literal.

This limitation makes it somewhat harder to implement "show this
variable/expression in binary" command in a GUI. Are there any easy
workarounds?

- Volodya




More information about the Gdb mailing list