I was trying to use tracemem to look at mblk contents. First, I tried to use mblk->b_wptr - mblk->b_rptr as the size, and was told that it had to be a constant. Foo. (RFE #1). Then, I tried to use 8 as the size, and kept getting decimal numbers printed. Stumbled on #pragma D option rawbytes=true (is the =true necessary, btw?) and that didn''t help. Then, in desperation, I changed the size to 16. Voila! I *think* this is because tracemem() doesn''t really look at rawbytes before it looks for size 1, 2, 4, or 8 bytes, and handles them specially. But I''m gonna call this a bug in the rawbytes option implementation. Agreed?
Adam Leventhal
2006-Jun-29 07:40 UTC
[dtrace-discuss] tracemem() not exactly what I had in mind
On Wed, Jun 28, 2006 at 08:48:11PM -0700, Dan Mick wrote:> I was trying to use tracemem to look at mblk contents. First, I tried to > use > mblk->b_wptr - mblk->b_rptr as the size, and was told that it had to be a > constant. Foo. (RFE #1).It would be nice to be able to implement that RFE, but one the simplifying assumptions that DTrace makes is that trace records from a given probe are of a fixed size. Can you just pick a really big default?> Then, I tried to use 8 as the size, and kept getting decimal numbers > printed. Stumbled on #pragma D option rawbytes=true (is the =true > necessary, btw?) and that didn''t help. > > Then, in desperation, I changed the size to 16. Voila! > > I *think* this is because tracemem() doesn''t really look at rawbytes before > it looks for size 1, 2, 4, or 8 bytes, and handles them specially. But I''m > gonna call this a bug in the rawbytes option implementation. Agreed?If the size is 1, 2, 4, or 8 bytes, DTrace assumes that you''re tracing an integral type and prints it as a signed decimal integer. A reasonable RFE might be to have tracemem() always pay attention to rawbytes. Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Bill Sommerfeld
2006-Jun-30 00:40 UTC
[dtrace-discuss] tracemem() not exactly what I had in mind
On Thu, 2006-06-29 at 03:40, Adam Leventhal wrote:> On Wed, Jun 28, 2006 at 08:48:11PM -0700, Dan Mick wrote: > > I was trying to use tracemem to look at mblk contents. First, I tried to > > use > > mblk->b_wptr - mblk->b_rptr as the size, and was told that it had to be a > > constant. Foo. (RFE #1). > > It would be nice to be able to implement that RFE, but one the simplifying > assumptions that DTrace makes is that trace records from a given probe are of > a fixed size. Can you just pick a really big default?what i''d like to see (because mblks are so ubiquitous in certain corners of the kernel) is: tracemblk(mp, offset, maxlen) So long as maxlen is a constant (and you have a careful mblk-chain walker which won''t get stuck in a loop -- and I can think of a couple of different ways to pull this offf) I think this fits the dtrace safety model. - Bill