wkz / ply

Light-weight Dynamic Tracer for Linux
https://wkz.github.io/ply
GNU General Public License v2.0
402 stars 156 forks source link

ply v0.2 isn't runnable on anything I tried yet #9

Closed aktau closed 6 years ago

aktau commented 6 years ago
13:21:25 wkz/ply git:(master) ✗ » ./src/ply scripts/ptysnoop.ply
info: creating kallsyms cache
warning: unable to create kallsyms cache: Operation not permitted
<input>:3:19-40: error: unknown symbol 'strcmp'.
13:21:27 wkz/ply git:(master) ✗ » sudo ./src/ply scripts/ptysnoop.ply
[sudo] password for aktau: 
<input>:3:19-40: error: unknown symbol 'strcmp'.
13:21:36 wkz/ply git:(master) ✗ » sudo ./src/ply scripts/opensnoop.ply

14: error: syntax error, unexpected AGG
13:21:41 wkz/ply git:(master) ✗ » sudo ./src/ply scripts/execsnoop.ply
6: error: syntax error, unexpected '=', expecting ';'
13:21:47 wkz/ply git:(master) ✗ » sudo ./src/ply scripts/net-rx.ply
6: error: syntax error, unexpected AGG

You're probably aware of this, I just wanted to try it out. Do you have some updated scripts which work? I assume you try running it after making a change :D.

It might be nice to have a "compile-but-don't-execute" mode so that you can run some CI (travis) on every commit.

Thanks for ply(1), it's the neatest little bytecode compiler I know.

wkz commented 6 years ago

Yes I am aware of that. Documentation and examples are all still stuck in 1.x land :smile:

There's not a whole lot of (user-facing) things that are done yet. In general I've tried to be more compatible with DTrace's syntax wherever possible. http://dtrace.org/guide is my bible. Simple aggregations should work, but have a slightly different syntax vs. 1.x:

ply 'k:SyS_read { @[comm] = quantize(arg2); }'

I imagine three layers of testing. The first is obviously unittesting. The second is the method you're describing, the ply part of this is already there (run ply with -e, also add -S to see a dump of the compiled program). The third involves creating a set of small executables with known calling patterns, and then tracing these with ply as they are executed, verifying the ply output against expected values. Almost none of this is in place today, but it is in The Plan :wink:

Thank you for those kind words.

wkz commented 6 years ago

Fixed in 811a515f229fbc9490ea1f610621462e22adb3b3