Hi Brian,

It's all magic. :)

Please see
    http://blogs.sun.com/sherrym/entry/obtaining_function_arguments_on_amd64
for details.  The file that should answer the rest of you questions is
    usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c

Hope that helps,
Sherry

----- Forwarded message from Brian Xu - Sun Microsystems - Beijing China 
<Brian.Xu at sun.com> -----
  
Date: Tue, 09 Dec 2008 10:32:20 +0800
From: Brian Xu - Sun Microsystems - Beijing China <brian...@sun.com>
Subject: [mdb-discuss] A question: how the '::findstack -v' in mdb works?
To: mdb-discuss at opensolaris.org
  
Hi,
  
I have a question: how the cmd '::findstack -v' in mdb works?
  
In x32, it is easy to understand, since all the args are on the stack,
while for amd64, since the args(<6) are not put on the stack, and those
regs used to pass args(rdi, rsi, rdx, rcx, r8, r9) may be reused within
the function, so I am curious when backtracing the stack, how to know
the value of the args passed to the function's father, grandfather,
great grandfather, etc?
  
Likewise in sparc, since at any time only the current register window
can be accessed, so if we want to backtrace the stack, we can only
access the fp(i6) and args(i0-i5) of the function's father, and how we
can access those of the grandfather, great grandfather, etc?
  
Thanks,
Brian
  
_______________________________________________
mdb-discuss mailing list
mdb-discuss at opensolaris.org
  
----- End forwarded message -----

-- 
Sherry Moore, Solaris Core Kernel       http://blogs.sun.com/sherrym

Reply via email to