pavel filipensky - Sun Microsystems - Prague Czech Republic
2006-Jul-12 15:49 UTC
[dtrace-discuss] args[] typed to ''struct timeval'' leads to invalid alignment error
Hi, I have following script: =================#!/usr/sbin/dtrace -Fs /* struct timeval { long tv_sec; long tv_usec; }; clnt_cots_kcallit(CLIENT *h, rpcproc_t procnum, xdrproc_t xdr_args, caddr_t argsp, xdrproc_t xdr_results, caddr_t resultsp, struct timeval wait) */ ::clnt_cots_kcallit:entry { printf("wait=%d",args[6].tv_sec); } ::clnt_cots_kcallit:entry { printf("wait=%d",arg6); } ::clnt_cots_kcallit:entry { printf("wait=%llx",arg6); } ================================== Output is like this: dtrace: error on enabled probe ID 1 (ID 55082: fbt:rpcmod:clnt_cots_kcallit:entry): invalid alignment (0x3c) in action #1 at DIF offset 8 << Probe1 0 -> clnt_cots_kcallit wait=60 << Probe2 0 | clnt_cots_kcallit:entry wait=3c << Probe3 The timeval value is <60 sec; 0 usec>. Probe 2 shows the sec correctly. Probe1 gives error invalid alignment (0x3c). Ox3c is 60 decimal - it means Probe1 was taking value 60 as an address. According to docs.sun.com: Solaris Dynamic Tracing Guide the args[] should be typed. For our args[6] it should be typed to struct timeval, but is not. Question is whether this is problem in implementation or in documentation or whether this is correct behaviour. ANother question - What is the most simple access to the timeval.tv_sec and timeval.tv_usec values? Thank you, Pavel Filipensky
Jonathan Adams
2006-Jul-12 16:52 UTC
[dtrace-discuss] args[] typed to ''struct timeval'' leads to invalid alignment error
On Wed, Jul 12, 2006 at 05:49:18PM +0200, pavel filipensky - Sun Microsystems - Prague Czech Republic wrote:> dtrace: error on enabled probe ID 1 (ID 55082: > fbt:rpcmod:clnt_cots_kcallit:entry): invalid alignment (0x3c) in action > #1 at DIF offset 8 << Probe1 > 0 -> clnt_cots_kcallit wait=60 << Probe2 > 0 | clnt_cots_kcallit:entry wait=3c << Probe3 > > > The timeval value is <60 sec; 0 usec>. Probe 2 shows the sec correctly. > Probe1 gives error invalid alignment (0x3c). Ox3c is 60 decimal - it > means Probe1 was taking value 60 as an address. > > According to docs.sun.com: Solaris Dynamic Tracing Guide the args[] > should be typed. > For our args[6] it should be typed to struct timeval, but is not. > Question is whether this is problem in implementation or in > documentation or whether this is correct behaviour.It looks like the implementation is incorrect; it''s assuming that, since the type is a structure, the passed argument is a pointer value. That''s correct for large structures, but for for small structures, the ABI specifies that they are passed as multiple arguments to the function. In this case, arg6 is the tv_sec field, and arg7 is the tv_usec field. Cheers, - jonathan> ANother question - What is the most simple access to the timeval.tv_sec > and timeval.tv_usec values?arg6 and arg7, respectively. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Jonathan Adams
2006-Jul-12 17:45 UTC
[dtrace-discuss] args[] typed to ''struct timeval'' leads to invalid alignment error
On Wed, Jul 12, 2006 at 09:52:02AM -0700, Jonathan Adams wrote:> On Wed, Jul 12, 2006 at 05:49:18PM +0200, pavel filipensky - Sun Microsystems - Prague Czech Republic wrote: > > dtrace: error on enabled probe ID 1 (ID 55082: > > fbt:rpcmod:clnt_cots_kcallit:entry): invalid alignment (0x3c) in action > > #1 at DIF offset 8 << Probe1 > > 0 -> clnt_cots_kcallit wait=60 << Probe2 > > 0 | clnt_cots_kcallit:entry wait=3c << Probe3 > > > > > > The timeval value is <60 sec; 0 usec>. Probe 2 shows the sec correctly. > > Probe1 gives error invalid alignment (0x3c). Ox3c is 60 decimal - it > > means Probe1 was taking value 60 as an address. > > > > According to docs.sun.com: Solaris Dynamic Tracing Guide the args[] > > should be typed. > > For our args[6] it should be typed to struct timeval, but is not. > > Question is whether this is problem in implementation or in > > documentation or whether this is correct behaviour. > > It looks like the implementation is incorrect; it''s assuming that, since the > type is a structure, the passed argument is a pointer value. That''s > correct for large structures, but for for small structures, the ABI specifies > that they are passed as multiple arguments to the function. In this case, > arg6 is the tv_sec field, and arg7 is the tv_usec field.I''ve filed: 6448142 args[] handling doesn''t work for small structures to cover this. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Jeremy Harris
2006-Jul-13 08:30 UTC
[dtrace-discuss] args[] typed to ''struct timeval'' leads to invalid alignment error
Jonathan Adams wrote:> On Wed, Jul 12, 2006 at 09:52:02AM -0700, Jonathan Adams wrote: >> It looks like the implementation is incorrect; it''s assuming that, since the >> type is a structure, the passed argument is a pointer value. That''s >> correct for large structures, but for for small structures, the ABI specifies >> that they are passed as multiple arguments to the function. In this case, >> arg6 is the tv_sec field, and arg7 is the tv_usec field. > > I''ve filed: > > 6448142 args[] handling doesn''t work for small structuresErk! A trifle unfortunate that users of dtrace need to know details of the ABI to that level. Is it in theory possible for Dtrace to hide that? - Jeremy
Jonathan Adams
2006-Jul-13 17:27 UTC
[dtrace-discuss] args[] typed to ''struct timeval'' leads to invalid alignment error
On Thu, Jul 13, 2006 at 09:30:15AM +0100, Jeremy Harris wrote:> Jonathan Adams wrote: > >On Wed, Jul 12, 2006 at 09:52:02AM -0700, Jonathan Adams wrote: > >>It looks like the implementation is incorrect; it''s assuming that, since > >>the > >>type is a structure, the passed argument is a pointer value. That''s > >>correct for large structures, but for for small structures, the ABI > >>specifies that they are passed as multiple arguments to the function. In > >>this case, > >>arg6 is the tv_sec field, and arg7 is the tv_usec field. > > > >I''ve filed: > > > >6448142 args[] handling doesn''t work for small structures > > Erk! A trifle unfortunate that users of dtrace need to know > details of the ABI to that level. Is it in theory possible > for Dtrace to hide that?Yes. It''s just work that hasn''t been done yet. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development