harvard-acc / LLVM-Tracer

An LLVM pass to profile dynamic LLVM IR instructions and runtime values
Other
135 stars 35 forks source link

How to generate LLVM6.0 trace of the main function(C++)? #45

Closed rem1A closed 2 years ago

rem1A commented 2 years ago

As I see the example in the playground, the WORKLOAD is top_level, which is a function defined outside the main(), and it run successfully. But when I try to change the WORKLOAD to main, it reports error like this:

test-instrumented: /workspace/LLVM-Tracer/profile-func/trace_logger.cpp:132: logging_status log_or_not(bool, bool, int, char *): Assertion `false && "Returning from within a toplevel function before it was called!"' failed. Aborted (core dumped)

If I want to generate LLVM trace of the whole main function, what should I do?Or is it possible to make it in a C++ program using LLVM-Tracer 6.0?Did I missed any details?

Thank you very much

Kind regards

xyzsam commented 2 years ago

You can't trace main directly, but you can put all your code into a runMain function which you then trace.

rem1A commented 2 years ago

THANKS A LOT !!! I will try