質問

I need to generate a log file that contains the execution flow of a C or C++ program. This log file should contain each line of the program (with line number specified) in the order that is executed. What can be use for that? I tried with GDB but I couldn't do it.

役に立ちましたか?

解決

GDB can't do that automatically, but with simple script you should be able to step a program, until it ends and log everything. This will execute very slowly, as CPU will handle a breakpoint every few instructions. Also try looking into GDB's process reply feature.

There are other tools available for this purpose, as explained in this thread.

Hardware tools exist that can capture program execution "trace" while program is running at full speed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top