Hi Dean, thank you for the response!
I'm a newbie to LLVM, a student working on an LLVM project so I'm not
quite
sure of what you're suggesting, please excuse my naivety.
To clarify there used to exist this
http://llvm.org/releases/1.0/docs/CommandGuide/lli.html where you could
type "lli -trace 'filename.bc' and you would get a dump of the
dynamic
excutiion trace.
I need something like:
to record the execution (statement/instruction) trace of a program. For
example, a C program is like this:
1: sum = 0;
2: for(i = 0; i < 2; i++)
3: sum += i;
4: printf("%d", sum);
The execution trace would be something like
1->2->3->2->3->2->4.
Is there some way of achieving this, this was possible in previous verions
of LLVM <2.6 i believe; I need guidance of replicating this on the newer
version(using 3.8).
On 3 May 2016 at 21:18, Dean Michael Berris <dberris at google.com> wrote:
> Hi Ammar,
>
> I'm not sure about lli, but recently I sent an RFC for XRay, which does
a
> combination of compiler-inserted instrumentation points and a runtime
> library that will allow for enabling these instrumentation points. Those
> could be used to log/trace function calls.
>
> I'm currently working on getting that into LLVM, Clang, and compiler-rt
> among other things.
>
> Does that help?
>
> PS. More information in the whitepaper (
> https://research.google.com/pubs/pub45287.html) we recently published.
>
> On Wed, May 4, 2016 at 2:05 PM Ammar Naqvi via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> hi everyone,
>>
>> I'm trying to get something like the lli - trace functionality that
has
>> been deprecated.
>>
>> I need the same thing that the trace command was doing i. e. the
dynamic
>> execution trace, any idea on what it has moved to if it still exists
or
>> how to implement it?
>>
>> Best Regards,
>> Ammar Naqvi
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160503/56cb4636/attachment.html>
Dean Michael Berris via llvm-dev
2016-May-04 05:48 UTC
[llvm-dev] llvm dynamic execution trace
On Wed, May 4, 2016 at 3:10 PM Ammar Naqvi via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Dean, thank you for the response! > > I'm a newbie to LLVM, a student working on an LLVM project so I'm not > quite sure of what you're suggesting, please excuse my naivety. > > To clarify there used to exist this > http://llvm.org/releases/1.0/docs/CommandGuide/lli.html where you could > type "lli -trace 'filename.bc' and you would get a dump of the dynamic > excutiion trace. > > I need something like: > to record the execution (statement/instruction) trace of a program. For > example, a C program is like this: > > 1: sum = 0; > 2: for(i = 0; i < 2; i++) > 3: sum += i; > 4: printf("%d", sum); > > The execution trace would be something like 1->2->3->2->3->2->4. > > Is there some way of achieving this, this was possible in previous verions > of LLVM <2.6 i believe; I need guidance of replicating this on the newer > version(using 3.8). >Ah, that's slightly different from what XRay allows. I'll let others respond more specifically on what you're after. Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160504/81ed9742/attachment-0001.html>
Hello.
Ammar, I come back to this old thread.
Even with the current lli you can give
lli --debug -force-interpreter -stats
and you will obtain on stderr a trace of the instructions executed.
Unfortunately, the information printed on stderr is not well formatted - I
edited
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp, the Interpreter::run()
method. You can
find how the code looks now below.
An important question I have is: how can I output the actual values the
LLVM
variables take during execution? I ask because the code below I wrote outputs
the static
values of the instruction operands, not the values taken at runtime.
I'm also curious: is there a project adding a GUI frontend to lli in
order to perform
interactive debugging to an LLVM program (something like gdb -tui mode)? I
wasn't able to
find any after a few minutes of search on the Internet.
void Interpreter::run() {
while (!ECStack.empty()) {
// Interpret a single instruction & increment the "PC".
ExecutionContext &SF = ECStack.back(); // Current stack frame
Instruction &I = *SF.CurInst++; // Increment before execute
// Track the number of dynamic instructions executed.
++NumDynamicInsts;
DEBUG(dbgs() << "About to interpret: " << I);
// Alex: new code
DEBUG(dbgs() << "\n");
const char *opcodeName = I.getOpcodeName();
if ( (strcmp(opcodeName, "call") != 0) &&
(strcmp(opcodeName, "br") != 0) ) {
for (unsigned int i = 0; i < I.getNumOperands(); i++) {
DEBUG(dbgs() << " arg " << i <<
": " << * (I.getOperand(i)) << "\n");
}
}
// Alex: END new code
visit(I); // Dispatch to one of the visit* methods...
}
}
Thank you,
Alex
On 5/4/2016 8:48 AM, Dean Michael Berris via llvm-dev
wrote:> On Wed, May 4, 2016 at 3:10 PM Ammar Naqvi via llvm-dev <llvm-dev at
lists.llvm.org
> <mailto:llvm-dev at lists.llvm.org>> wrote:
>
> Hi Dean, thank you for the response!
>
> I'm a newbie to LLVM, a student working on an LLVM project so
I'm not quite sure of
> what you're suggesting, please excuse my naivety.
>
> To clarify there used to exist
> this http://llvm.org/releases/1.0/docs/CommandGuide/lli.html where you
could type "lli
> -trace 'filename.bc' and you would get a dump of the dynamic
excutiion trace.
>
> I need something like:
> to record the execution (statement/instruction) trace of a program.
For example, a C
> program is like this:
>
> 1: sum = 0;
> 2: for(i = 0; i < 2; i++)
> 3: sum += i;
> 4: printf("%d", sum);
>
> The execution trace would be something like
1->2->3->2->3->2->4.
>
> Is there some way of achieving this, this was possible in previous
verions of LLVM
> <2.6 i believe; I need guidance of replicating this on the newer
version(using 3.8).
>
>
> Ah, that's slightly different from what XRay allows. I'll let
others respond more
> specifically on what you're after.
>
> Cheers
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>