James McIlree
2007-Nov-09 00:41 UTC
[dtrace-discuss] global & thread-local variables behave differently?
Does anyone know why these scripts behave differently? It looks to me like the thread local variable is being treated as un-initialized, or a pointer without backing store. Is this intentional? James M # cat global.d struct foo { int a; }; struct foo ttest; BEGIN { ttest.a = 3; } # dtrace -s global.d dtrace: script ''global.d'' matched 1 probe ^C # cat thread-local.d struct foo { int a; }; self struct foo ttest; BEGIN { self->ttest.a = 3; } # dtrace -s thread-local.d dtrace: script ''thread-local.d'' matched 1 probe dtrace: error on enabled probe ID 1 (ID 1: dtrace:::BEGIN): invalid address (0x0) in action #1 at DIF offset 8 ^C
Adam Leventhal
2007-Nov-09 02:53 UTC
[dtrace-discuss] global & thread-local variables behave differently?
Hi James, This looks like a bug. Feel free to file it. Adam On Thu, Nov 08, 2007 at 04:41:21PM -0800, James McIlree wrote:> > Does anyone know why these scripts behave differently? > > It looks to me like the thread local variable is being treated as > un-initialized, or a pointer without backing store. > > Is this intentional? > > James M > > # cat global.d > struct foo { int a; }; > struct foo ttest; > > BEGIN > { > ttest.a = 3; > } > # dtrace -s global.d > dtrace: script ''global.d'' matched 1 probe > ^C > > # cat thread-local.d > struct foo { int a; }; > self struct foo ttest; > > BEGIN > { > self->ttest.a = 3; > } > # dtrace -s thread-local.d > dtrace: script ''thread-local.d'' matched 1 probe > dtrace: error on enabled probe ID 1 (ID 1: dtrace:::BEGIN): invalid > address (0x0) in action #1 at DIF offset 8 > ^C > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, FishWorks http://blogs.sun.com/ahl