views:

56

answers:

1

Why do the functions displayed in a callstack generated in Solaris always contain 6 parameters?

In most of the cases, the original function will not be having 6 parameters at all. Sometimes I also find, the parameter values displayed are not matching the order in function declaration.

Any pointers or links for understanding these concepts and debugging in Solaris will be helpful.

+2  A: 

I believe, depending on your version of Solaris (64 bit?), that the calling convention specifies the first 6 parameters of a function be passed by registers. Even if they're not being used, your debugger may just be showing the contents of these 6 registers.

Edit: from http://publib.boulder.ibm.com/httpserv/ihsdiag/get_backtrace.html#pstack

Note that pstack doesn't know how many arguments there are so it always displays six. So if you know that some function has only two arguments, ignore whatever pstack displays after the first argument.
Bob
That seems like a tenuous connection given that the six values being displayed in the stack trace couldn't possibly come from registers anyway. The registers could only be accurate for the *current* function, but pstack shows values for *all* the functions on the call stack.
Rob Kennedy
@Rob - this was originally done on SPARC, where they can come from registers, thanks to SPARC's register windows: http://www.sics.se/~psm/sparcstack.html
alanc