Abhay Kamesh Potharaju via llvm-dev
2020-Jun-09 15:16 UTC
[llvm-dev] Is it possible to get the exact PC address of an instruction?
I wish to perform some instrumentation at a particular PC address/instruction using LLVM and I wished to know if getting the PC address of the instruction is in fact possible given the nature of the llvm compiler? For instance, I wish to inject a fault multiple times at the same instruction address and analyze this behavior. I wish to get the PC address of the instruction so as to be able to point to it as my injection target for all my runs. Regards Abhay Potharaju -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200609/6abb26d1/attachment.html>
Robinson, Paul via llvm-dev
2020-Jun-09 17:46 UTC
[llvm-dev] Is it possible to get the exact PC address of an instruction?
Hello Abhay, Are you talking about fault injection at runtime? With an instruction generated from C/C++ source? I can imagine using a label in the source code, and finding the address of that label afterward, which limits you to the first instruction generated after the label. But in the general case, if I had to do this myself, I’d probably end up disassembling the object file to find the instruction of interest; or generating asm source (with -S) and inserting a label before running it through the assembler. None of these tactics do anything clever within LLVM, it would work with any toolchain. Good luck, --paulr From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Abhay Kamesh Potharaju via llvm-dev Sent: Tuesday, June 9, 2020 11:16 AM To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Is it possible to get the exact PC address of an instruction? I wish to perform some instrumentation at a particular PC address/instruction using LLVM and I wished to know if getting the PC address of the instruction is in fact possible given the nature of the llvm compiler? For instance, I wish to inject a fault multiple times at the same instruction address and analyze this behavior. I wish to get the PC address of the instruction so as to be able to point to it as my injection target for all my runs. Regards Abhay Potharaju -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200609/11d4061a/attachment.html>