gdb macros xp and xxp

Norbert Koch nkoch at demig.de
Thu Apr 5 09:03:00 UTC 2007


Hello,

for learning about gdb macros
I looked through gdbinit-1.i386.
( or is there some secret gdb manual
 that *explains* macros?  :-)

The macros xp and xxp calculate
the number of possible arguments as:
  ((*(int*)$ebp)-(int)$ebp)/4-4

Let's see (assuming "char* ebp"):
  *ebp : saved ebp from previous frame
  *(ebp+4) : saved eip
  *(ebp+8): first parameter (if any)
  *((*ebp)-4): saved register or local variable from previous frame
Right?

What I do not understand is the
subtraction of 4 (I expected 2).
When disassembling through different
portions of the kernel code and userland
programs, I found pushing of none up to
three extra register (ebx, esi, ebp).
But that depends heavyly on compiler options,
doesn't it?

So, is it just a guess that there are two register
variables or am I missing something?

Any comments?

Norbert


More information about the freebsd-hackers mailing list