G'Day,

On Mon, Jul 11, 2011 at 11:33 PM, Bryan Cantrill <br...@joyent.com> wrote:

> All,
>
> With my apologies for having been somewhat on a tear through old
> DTrace RFEs, another that has been annoying as of late is that
> tracemem() does not take a dynamic size.  Of course, EPIDs must
> correspond to a static size, so the fix is not to make the size
> entirely dynamic, but rather to add an optional third argument to
> tracemem() that is a D expression that captures the dynamic size --
> provided that it is no greater than the static size (still) provided
> as the second argument.  A patch that implements this is attached for
> your review and consideration; as with our other work, this will be
> showing up at http://github.com/joyent/illumos-joyent in the near
> future (our ticket for this is OS-481, "DTrace tracemem() action
> should take a dynamic size argument").  Note the fix for another
> long-standing falls out of this:  if you tracemem() something that is
> a string, it will show up as a proper hex dump instead of being
> interpreted as a string.  Please let me know if you have any questions
> or comments!
>
>
Many thanks!

If anyone is wondering about an example use case, I ran into this only a
couple of weeks ago when blogging about copyin(), writing:

"1st caveat: The "100" in the above one-liner is the length for tracemem();
unfortunately, it must be a scalar constant and can't be a variable,
otherwise I'd use "arg1" to print the entire returned length."

(The blog post was:
http://dtrace.org/blogs/brendan/2011/06/30/tweaking-memory-on-the-fly/)

This fix will let me pick a max-expected returned length for arg1, and then
use the extra arg to truncate it.  I'll need to update the blog post. :-)

Brendan

-- 
Brendan Gregg, Joyent                      http://dtrace.org/blogs/brendan
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to