开发者

GCC: Force a function call after every instruction (for multithreaded testing)?

开发者 https://www.devze.com 2022-12-11 06:55 出处:网络
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 ma

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?

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. Compiler generated assembler is relative easy to parse.

Don't forget to save the flags and all registers inside your debugging code though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号