Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

How can I instrument if statements inside a function? #3

Open
aliahsan07 opened this issue Nov 24, 2017 · 3 comments
Open

How can I instrument if statements inside a function? #3

aliahsan07 opened this issue Nov 24, 2017 · 3 comments

Comments

@aliahsan07
Copy link

I want to instrument every if function encountered inside a function. For example if my code hits
if x > 2:
I want to record/ print "x > 2" to the console.
Can equip help me out in this regard?

@neuroo
Copy link
Owner

neuroo commented Nov 25, 2017

Unfortunately, that's not possible with the current version of equip. The instrumentation is only possible at function boundaries (the instrumentation code is directly injected in the bytecode w/o trampoline, so that makes it harder to work at the block level or bytecode instr level).

Most of the tools should be there though so you can implement this feature, however, it's not something I'll have the time to work on. Happy to take a pull request.

@neuroo neuroo closed this as completed Nov 25, 2017
@neuroo neuroo reopened this Nov 25, 2017
@aliahsan07
Copy link
Author

so you're suggesting a basic block level implementation will be required which is currently not supported?

@neuroo
Copy link
Owner

neuroo commented Nov 26, 2017

If you really want to instrument the expressions in conditionals, so you want to know which of the expression is true prior to executing the body of a basic block, then you need to instrument at the bytecode instruction level.

On the other hand, if you only need to know you reached a given basic block, then the basic block level instrumentation will be sufficient (and largely easier to do).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants