On 04/ 7/10 06:32 PM, Nicolas Williams wrote:
On Wed, Apr 07, 2010 at 06:15:22PM +0200, Mark Phalan wrote:
But this isn't about user-land data. The structs I'm talking about
are dtrace native structs defined in the d script. In the example I
gave I wasn't even tracing a program - it was pure d. CTF data
doesn't come into it...

Duh.  Well, this works:

   2 typedef struct complex {
   3         uint32_t simplevalue;
   4 } complex_t;
   5
   6 translator complex_t<  uint32_t x>  {
   7         simplevalue = x;
   8 };
   9
  10 dtrace:::BEGIN {
  11         printf("simplevalue: %d\n", xlate<complex_t>(2).simplevalue);
  12 }


I guess I wasn't too clear.. I don't have any problems writing translators for "simple" structs. My problem is when the struct contains another struct which I'd like to initialize/set in the translator.

I couldn't get your example to work.

Right. I was wondering if someone knew if it was possible to modify my example to get it to work. I think this should be possible and if it's not currently then I'll probably open a CR for it.

-M
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to