[llvm-dev] Dynamic Fault Injection with LLVM
Xiangyang Guo via llvm-dev
llvm-dev at lists.llvm.org
Thu Dec 10 06:41:43 PST 2015
If I understand correctly, you need to first traverse the module, function,
bbs and then detect the instructions that you want to modify. You can use
the getOpcode() or getOpcodeName() to detect the instruction that you want
to modify. Then you need to know which operand you want to modify. You can
use getOperand(i) to get the ith operand of one instruction, and then use
setOperand(i, new_value) to set the new operand. You can see the examples
from the links in your email.
But all these are done in IR level. In the assembly, these instructions
could be deleted/modified/optimized.
2015-12-10 0:06 GMT-05:00 Andres Torres Garcia via llvm-dev <
llvm-dev at lists.llvm.org>:
> I want to use LLVM to make a dynamic fault injection. My primary goal is
> to modify the value of a particular register in a particular instruction
> and do, for example, bit flipping on that register.
> I've studying some tutorials and codes about LLVM but I'm still not sure
> how to begin with. I know that I need to program a LLVM pass that iterates
> over blocks and check which instruction modify to later check which operand
> in that instruction modify. Is that the correct?
> I've seen some examples but all of them seem very complicated (a lot of
> code) to understand for a beginner like me. I wonder if there is an easier
> example to understand or if you can provide me with one to start with.
> Thank you very much for your help!
> Examples that I haven't understood:
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev