I''ve been trying to do something relatively simple, but seem thwarted on it: # dtrace -n ''fbt::calcloadavg:entry { printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", `cpu0.cpu_acct[0], `cpu0.cpu_acct[1], `cpu0.cpu_waitrq);}'' results in: dtrace: invalid probe specifier fbt::calcloadavg:entry { printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", `cpu0.cpu_acct[0], `cpu0.cpu_acct[1], `cpu0.cpu_waitrq);}: in action list: no symbolic type information is available for unix`cpu0: No type information available for symbol I''ve tried some casts, both as a pointer, and just a cpu_t: # dtrace -n ''fbt::calcloadavg:entry { cpu = (cpu_t)`cpu0; printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", cpu.cpu_acct[0], cpu.cpu_acct[1], cpu.cpu_waitrq);}'' # dtrace -n ''fbt::calcloadavg:entry { cpup = (cpu_t *)&`cpu0; printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", cpup->cpu_acct[0], cpup->cpu_acct[1], cpup->cpu_waitrq);}'' but they all result in the same error. I see why from the source, as cpu0 has no type. I''ve been working around it mostly using `cpu_list-> instead, but is there any way to tell dtrace "trust me, it''s a cpu_t"? Thanks, John
Michael Shapiro
2006-Nov-02 16:06 UTC
[dtrace-discuss] accessing symbols without type info
> I''ve been trying to do something relatively simple, but seem thwarted on it: > > # dtrace -n ''fbt::calcloadavg:entry { printf("CMS_USER: %d, CMS_SYSTEM: > %d, cpu_waitrq: %d\n", `cpu0.cpu_acct[0], `cpu0.cpu_acct[1], > `cpu0.cpu_waitrq);}'' > > results in: > > dtrace: invalid probe specifier fbt::calcloadavg:entry { > printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", > `cpu0.cpu_acct[0], `cpu0.cpu_acct[1], `cpu0.cpu_waitrq);}: in action > list: no symbolic type information is available for unix`cpu0: No type > information available for symbol > > I''ve tried some casts, both as a pointer, and just a cpu_t: > > # dtrace -n ''fbt::calcloadavg:entry { cpu = (cpu_t)`cpu0; > printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", > cpu.cpu_acct[0], cpu.cpu_acct[1], cpu.cpu_waitrq);}'' > # dtrace -n ''fbt::calcloadavg:entry { cpup = (cpu_t *)&`cpu0; > printf("CMS_USER: %d, CMS_SYSTEM: %d, cpu_waitrq: %d\n", > cpup->cpu_acct[0], cpup->cpu_acct[1], cpup->cpu_waitrq);}'' > > but they all result in the same error. I see why from the source, as > cpu0 has no type. > > I''ve been working around it mostly using `cpu_list-> instead, but is > there any way to tell dtrace "trust me, it''s a cpu_t"? > > Thanks, > JohnUnfortunately the casting logic in the compiler has to first obtain the source type for the thing you''re trying to cast to determine if the cast is legal, and we''re failing to even get the type since it''s declared in assembly code. I suppose some override pragma is possible for this, but it doesn''t exist at the moment. That said, you should be able to use the cpu[] array w/ cpu[0] to get what you want. -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/