在文件中添加的printf到的所有功能出发 [英] Adding printf to the starting of all functions in a file

查看:127
本文介绍了在文件中添加的printf到的所有功能出发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些非常大的C文件,有很多的功能。我需要跟踪的执行路径在运行时。有没有办法我可以跟踪它通过调试作为其管理程序code当前运行在QEMU和做大量的二进制翻译的。

I have some very large C files, having lots of functions. I need to trace the execution path at run time. There is no way I can trace it through debugging as its a hypervisor code currently running over qemu and doing a lot of binary translations.

任何人都可以点我在Perl或Python一些脚本可在所有功能的起点添加一个的printf 和文本可能是这样的:我上述&lt ;函数名>

Can anyone point me to some script in Perl or Python which can add a printf at the starting of all functions and the text could be something like "I am in < function name >"?

推荐答案

就在编译时通过 -finstrument函数到GCC。请参阅 GCC(1)手册页了解详情。

Just pass -finstrument-functions to gcc when compiling. See the gcc(1) man page for details.

这篇关于在文件中添加的printf到的所有功能出发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆