brainfuck icon indicating copy to clipboard operation
brainfuck copied to clipboard

[Idea] Instrumentation Framework

Open offlinemark opened this issue 9 years ago • 5 comments

i think it could be cool to explore this idea of an instrumentation framework for bf. like being able to register callbacks not just after each step, but like before and after interpretation, before and after the instruction itself, on certain types of instructions, maybe even on ub. you could then use that to write analysis tools, for example

i'm basically thinking of doing something in the spirit of pin (https://software.intel.com/en-us/articles/pin-a-dynamic-binary-instrumentation-tool)

offlinemark avatar Dec 13 '15 18:12 offlinemark

This mostly boils down to extending the hook capabilities, and then writing some statistics hooks right?

nixpulvis avatar Dec 13 '15 18:12 nixpulvis

yeah pretty much

offlinemark avatar Dec 13 '15 19:12 offlinemark

I added the -i option, but it could clearly do more. What kinds of things are you thinking for this?

nixpulvis avatar Dec 18 '15 01:12 nixpulvis

I guess this doesn't really make sense since bf is so minimal.

My initial thoughts were for this use case: you have a brainfuck program and you want to get certain statistics on its execution. You implement some hook functions, compile it into a shared object and then give that to the interpreter. Then at runtime, the interpreter loads the .so and calls those hooks at certain stages we support.

offlinemark avatar Dec 19 '15 21:12 offlinemark

I like the idea of playing with some dynamic loading of symbols. Good exercise.

nixpulvis avatar Dec 19 '15 21:12 nixpulvis