nixpulvis / brainfuck

A simple brainfuck interpreter in Rust.
http://nixpulvis.com/brainfuck
23 stars 3 forks source link

[Idea] Instrumentation Framework #9

Open offlinemark opened 8 years ago

offlinemark commented 8 years ago

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)

nixpulvis commented 8 years ago

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

offlinemark commented 8 years ago

yeah pretty much

nixpulvis commented 8 years ago

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

offlinemark commented 8 years ago

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.

nixpulvis commented 8 years ago

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