[dtrace-discuss] Accessing variables in shared libraries

Seth Goldberg Seth.Goldberg at Sun.COM
Mon Jul 2 13:11:08 PDT 2007


> On Mon, Jul 02, 2007 at 12:40:58PM -0700, Seth Goldberg wrote:
>> dtrace: failed to compile script ./tt.d: line 6: floating-point constants are not permitted
>
> IIRC DTrace doesn't support floating point types.

   That's fine, but I wasn't specifying a floating point constant -- I 
specified "libc.so.1`".

>
>> 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?
>
> DTrace has no knowledge of variables and types in user-land.  Instead
> you have to use copyin() and friends and casts.  The result isn't very
> pretty, but it works.  I think one could add a function or operator that
> interprets simple expressions in the context of the user-land process to
> which the given pid provider probe refers; the expression would have to
> be compiled in user-land when the provider is opened and translated into
> a corresponding set of D expressions that copyin stuff as needed and
> which get shoved into the actul probe body.  But that sounds like a
> non-trivial project.

   That's also OK, if that syntax worked (unless I messed up the syntax).  I 
have no problem doing something like:

   printf("%u", *(uint64_t *)copyin(libc.so.1`set_lock_count));

  --S


More information about the dtrace-discuss mailing list