Speaker To Machines

Erik O'Shaughnessy - erik.oshaughnessy AT Sun.COM


20040813 Friday August 13, 2004

Perl+DTrace=Instruction Tracing

As promised, an ugly perl script that can be used to generate a custom DTrace script which will generate an instruction trace.

For instance:

trogdor:utrace -> ls
hello*      hello.c     utrace.pl*  utrace.txt* 
trogdor:utrace -> utrace.pl -i hello
trogdor:utrace -> sudo dtrace -Cs hello.t -c hello
...

For the interested, here is the text of the traced program, the DTrace script, and the output generated.

The perl script is no where near "feature complete", nor is it an example of good perl programming practice ( parts of it are legible ). But, say it with me, it scratched an itch :).

-ejo

(2004-08-13 12:54:05.0) Permalink

Comments:

Post a Comment:

Comments are closed for this entry.

archives
links
referers