<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/10/15 12:06 AM, Andres Torres
      Garcia via llvm-dev wrote:<br>
    </div>
    <blockquote cite="mid:BAY181-W5642DB3A3EB345A9AF4BCDB1E90@phx.gbl"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html;
        charset=iso-8859-1">
      <div dir="ltr">
        <div dir="ltr">
          <p>Hi,</p>
          <p><br>
          </p>
          <p>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.</p>
        </div>
      </div>
    </blockquote>
    <br>
    By dynamic, do you mean that you want to change which faults are
    injected while the program is running, or is it sufficient to
    recompile the program and rerun it when you want to inject new
    faults?<br>
    <br>
    Also, are you wanting to inject faults at the LLVM IR level, or do
    you want to inject faults after the program's machine code has been
    generated (e.g., you want to inject faults into a particular
    register)?<br>
    <br>
    The answers to these questions will determine whether you need to
    write an LLVM IR pass or an LLVM MachineFunction pass (or whether
    you really want to be modifying a dynamic binary translator like
    QEMU/Valgrind instead of using LLVM).<br>
    <br>
    <blockquote cite="mid:BAY181-W5642DB3A3EB345A9AF4BCDB1E90@phx.gbl"
      type="cite">
      <div dir="ltr">
        <div dir="ltr">
          <p><br>
          </p>
          <p>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?</p>
        </div>
      </div>
    </blockquote>
    <br>
    I think the first three documents to read are:<br>
    <br>
    1) How to Write an LLVM Pass<br>
    2) The LLVM Programmer's Manual<br>
    3) The LLVM Language Reference Manual<br>
    <br>
    The first document explains how to add a new analysis/transform to
    the compiler.  The second explains some of the utility functions and
    idioms that you will see in existing LLVM code.  The third describes
    (in gory detail) the LLVM IR instruction set.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>