<div dir="ltr"><div style>Hi John,</div><div style> </div>On Wed, Mar 6, 2013 at 10:01 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br>

<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <div>On 3/6/13 4:39 AM, Vardhan Varma wrote:</div><blockquote type="cite">
      
      <div dir="ltr">
        
        <div>  I'm wondering if there is feature already  in LLVM or
          clang to embed</div>
        <div>  variable tracing instructions in the compiled output, so
          that on execution</div>
        <div>  of the program, a dump of various variables values over
          time is generated.</div></div></blockquote></div></div>
    No, I don't believe there is a tool quite like that in LLVM. 
    However, we have a research prototype dynamic backwards slicing tool
    called Giri written with LLVM.  Giri instruments a program to record
    all basic block and loads/store executions in a trace file and can
    then use this trace to find all LLVM IR instructions that were
    executed in that execution of the program.<br>
    <br>
    You could probably enhance Giri with additional features to do what
    you describe.<br>
    <br>
    If you'd like a copy of Giri, please email the list.<br></div></blockquote><div style><br></div><div style>Thanks for mentioning the name of 'Giri',  </div><div style> I search the archives to get a pointer to the svn : <a href="https://llvm.org/svn/llvm-project/giri/trunk/">https://llvm.org/svn/llvm-project/giri/trunk/</a></div>

<div style> I saw from the code that it's not trying to use Metadata. I _think_ solution to my problem will require metadata.</div><div style><br></div><div style> <Explaining-My-Problem></div><div style>  Take a C  Code:</div>

<div style>      10. int a = 10;</div><div style>      11. int b = 100;</div><div style>      12. a = a + b;</div><div style>   I'm trying to see if I can instrument this  in LLVM-IR, so that a logfile like  this can be generated, when the program is executed:</div>

<div style>       line = 10, var=a, val=10</div><div style>       line = 11, var=b, val=100</div><div style>       line =  12, var=a, val=110</div><div style> </Explaining-My-Problem></div><div style>  </div><div style>

       Initially, it looked like the %llvm.dbg.value() intrinsic can be 'replaced' by a printf to achieve this. Howver, by looking at code , I was not able to follow as to when is the llvm.dbg.value() is generated.</div>

<div style> The reason for looking at %llvm.dbg.value() was that because it seemed that it already 'knows' about all the temporary names of the actualy variable. I'll keep investigating, though any more help will do wonders to my night-lamp  (-:</div>

<div style><br></div><div style>   </div><div style><br></div><div style>-Regards</div><div style>-Vardhan</div></div></div></div>