Feature #14103
openDTrace uregs[] should allow access to FSBASE and GSBASE
0%
Description
The DTrace errno
variable allows access to the error number that is returned by a system call, and is useful in the context of a syscall:::return
probe. When tracing library functions with the pid
provider, the situation is somewhat more complex; errno
is thread-local, so the specific value is somewhat harder to fish out. It's possible, for amd64
programs, to:
pid$target::port_getn:return { /* * Get the per-thread errno location for this thread: */ this->fsbase = curthread->t_lwp->lwp_pcb.pcb_fsbase; this->ulwp = (userland struct pid`ulwp *)this->fsbase; this->errnop = this->ulwp->ul_errnop; printf("errnop %p = %d\n", this->errnop, *this->errnop); }
At a minimum, it seems like we should provide access to the FSBASE value (or, I believe, the GSBASE value for i386) that is needed to find the ulwp structure for the current LWP. It would seem most logical to make these available through additional entries in the uregs[]
array (R_FSBASE
and R_GSBASE
), through they would perhaps be read-only entries at least initially.
No data to display