views:

133

answers:

1

Hi,

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

+5  A: 

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.

Nils Pipenbrinck
thanks! Hopefully the yield function will do that...
Robert Fraser
if it does not you can roll your own wrapper around yield.Good luck finding your bug...
Nils Pipenbrinck