Monday, April 04, 2005

More than 10 args in PID provider

We run into a problem that we couldn't catch more than 10 arguments in a function using PID provider in DTrace. Thanks to Adam Leventhal for workaround. I've checked it for SPARC 32/64 bit programs and it works. Ideally it would be getting args[] working with PID provider and allowing it to get more than 10 arguments - as Adam wrote to me they do work on this and consider allowing more arguments - great!

Workaround:


sparc 32-bit:
this->argN =
*(uint32_t *)copyin(uregs[R_SP] + sizeof (uint32_t) * (N + 17),
sizeof (uint32_t));
(only applies to args past the first 6)

sparc 64-bit:
this->argN =
*(uint64_t *)copyin(uregs[R_SP] + 0x7ff +
sizeof (uint64_t) * (N + 16), sizeof (uint64_t));
(only applies to args past the first 6)

x86:
this->argN =
*(uint32_t *)copyin(uregs[R_SP] + sizeof (uint32_t) * (N + 1),
sizeof (uint32_t));

amd64:
this->argN =
*(uint64_t *)copyin(uregs[R_SP] + sizeof (uint64_t) * (N - 5),
sizeof (uint64_t));
(only applies to args past the first 6)

No comments:

Post a Comment