[英]GCC: Force a function call after every instruction (for multithreaded testing)?
I'm trying to test a rather threading-sensitive area in my program and was wondering if there's a way to force gcc to insert a call after every instruction it emits so that I can manually yield to a different thread? 我正试图在我的程序中测试一个相当线程敏感的区域,并且想知道是否有办法强制gcc在它发出的每条指令后插入一个调用,以便我可以手动屈服于另一个线程?
Thanks, Robert 谢谢,罗伯特
No, GCC does not has such an option. 不,海湾合作委员会没有这样的选择。
However, you may be able hack together a script that does that job. 但是,您可以将执行该工作的脚本组合在一起。 You can compile your code to assembler using the -S option.
您可以使用-S选项将代码编译为汇编程序。 Compiler generated assembler is relative easy to parse.
编译器生成的汇编程序相对容易解析。
Don't forget to save the flags and all registers inside your debugging code though. 不要忘记将标志和所有寄存器保存在调试代码中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.