[dtrace-discuss] Accessing variables in shared libraries

Seth Goldberg Seth.Goldberg at Sun.COM
Mon Jul 2 12:40:58 PDT 2007


Hi,

  I'm been experimenting with libc and found a need to add a global variable that I track in a dtrace script (OS: Solaris 10 08/07, Build 10, SPARC), but I cannot seem to reference this variable  (either directly or via libc.so.1`).  The following errors result:

dtrace: failed to compile script ./tt.d: line 6: floating-point constants are not permitted

tt.d is:
-------------------------------------------------------------------
#!/usr/sbin/dtrace -Fs


pid$target:libc.so.1:set_lock_byte:entry
{
      printf("%u", libc.so.1`set_lock_count);
}
-------------------------------------------------------------------

(Note that I modified set_lock_byte also to make it traceable and to add code to modify set_lock_count).

The declaration for the new variable, set_lock_count, is "volatile uint64_t set_lock_count" and
it does show up in ctfdump output of libc.so.1 (and the types resolve correctly to volatile uint64_t).  Note also that trying to reference just the variable (by removing "libc.so.1`" also fails:

% ./tt.d -c /bin/ls
dtrace: failed to compile script ./tt.d: line 6: failed to resolve set_lock_count: Unknown variable name
).

  What am I doing wrong?  Can libraries (with dots) not be used as scope-resolution entities?

 Thanks,
 --S
--
This message posted from opensolaris.org


More information about the dtrace-discuss mailing list