You can somewhat do it with GCC, but it requires a linker script:<p><a href="http:&#x2F;&#x2F;mainisusuallyafunction.blogspot.ca&#x2F;2011&#x2F;11&#x2F;self-modifying-code-for-debug-tracing.html" rel="nofollow">http:&#x2F;&#x2F;mainisusuallyafunction.blogspot.ca&#x2F;2011&#x2F;11&#x2F;self-modif...</a>