Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Apr 2007 08:58:41 +0000
From:      Norbert Koch <nkoch@demig.de>
To:        freebsd-hackers@FreeBSD.org
Subject:   gdb macros xp and xxp
Message-ID:  <4614BA41.7080902@demig.de>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4614BA41.7080902>