Jeff Trawick
2009-Feb-10 14:20 UTC
[dtrace-discuss] dumb user error with preprocessor on 2008.11?
(x86) I see numerous posts about preprocessor problems, but nothing this simple... $ cat test.d #include "test.h" pid$1::accept:entry { printf("accept(%d)\n", arg0); } $ cat test.h typedef int16_t port_t; $ pfexec /usr/sbin/dtrace -32 -I. -C -s ./test.d 524 dtrace: failed to compile script ./test.d: "./test.h", line 1: syntax error near "port_t" $ cc -E ./test.d > foo.d $ pfexec /usr/sbin/dtrace -32 -s ./foo.d 524 dtrace: script ''./foo.d'' matched 1 probe ^C $ /usr/ccs/lib/cpp test.d > foo2.d $ diff foo.d foo2.d 1,2c1,2 < # 1 "./test.d" < # 1 "test.h" --- > # 1 "test.d" > # 1 "./test.h" 1 4c4 < # 2 "./test.d" --- > # 2 "test.d" 2 11d10 < #ident "acomp: Sun Ceres C 5.10 SunOS_i386 2008/10/22" $
Jeff Trawick
2009-Feb-12 17:12 UTC
[dtrace-discuss] dumb user error with preprocessor on 2008.11?
Jeff Trawick wrote:> (x86) > > I see numerous posts about preprocessor problems, but nothing this > simple... > > $ cat test.d > #include "test.h" > > pid$1::accept:entry > { > printf("accept(%d)\n", arg0); > } > $ cat test.h > typedef int16_t port_t; > $ pfexec /usr/sbin/dtrace -32 -I. -C -s ./test.d 524 > dtrace: failed to compile script ./test.d: "./test.h", line 1: syntax > error near "port_t"With just a little more tesing: I can use int16_t in the .d file itself when I use the preprocessor, just not in the included file. assert(DTrace type aliases can''t be used in files included by the preprocessor) (It would be great to have the confirmed restriction documented on the DTrace wiki -- http://wikis.sun.com/display/DTrace/Types,+Operators+and+Expressions)
Adam Leventhal
2009-Feb-16 04:13 UTC
[dtrace-discuss] dumb user error with preprocessor on 2008.11?
Hey Jeff,> With just a little more tesing: I can use int16_t in the .d file > itself when I use the preprocessor, just not in the included file. > > assert(DTrace type aliases can''t be used in files included by the > preprocessor)That''s a great analysis. If you haven''t already, please file a bug and we''ll try to sort out a way to address this.> (It would be great to have the confirmed restriction documented on > the DTrace wiki -- http://wikis.sun.com/display/DTrace/Types,+Operators+and+Expressions)If you''re willing, please take a crack at writing something up. As with all changes to the DTrace wiki, small edits can go right back, but we request that larger revisions first be posted here for comment (people lose the right to object after a week). Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Jeff Trawick
2009-Feb-17 12:36 UTC
[dtrace-discuss] dumb user error with preprocessor on 2008.11?
Adam Leventhal wrote:> Hey Jeff, > >> With just a little more tesing: I can use int16_t in the .d file >> itself when I use the preprocessor, just not in the included file. >> >> assert(DTrace type aliases can''t be used in files included by the >> preprocessor) > > That''s a great analysis. If you haven''t already, please file a bug and > we''ll try to sort out a way to address this.CR 6806314> >> (It would be great to have the confirmed restriction documented on >> the DTrace wiki -- >> http://wikis.sun.com/display/DTrace/Types,+Operators+and+Expressions) > > > If you''re willing, please take a crack at writing something up. As > with all changes to the DTrace wiki, small edits can go right back, > but we request that larger revisions first be posted here for comment > (people lose the right to object after a week).this page edited to list the restriction: http://wikis.sun.com/display/DTrace/Types%2C+Operators+and+Expressions related comment posted to this page: http://wikis.sun.com/display/DTrace/Type+and+Constant+Definitions