On 10/23/2015 11:37 AM, Yasser Shalabi wrote: > Hey Will, > > Thanks for the quick reply. Yeah I need the int3 instruction to be > statically included in he binary so I can't use any dynamic > instrumentation tool.
Dyninst can do binary rewrites of executables so that might still be suitable. http://www.dyninst.org/sites/default/files/downloads/w2009/legendre-binrewriter.pdf -Will > > On Fri, Oct 23, 2015 at 10:32 AM, William Cohen <wco...@redhat.com> wrote: >> On 10/23/2015 01:37 AM, Yasser Shalabi wrote: >>> Hello, >>> >>> I am new to the GCC code. I want to make a simple modification to the >>> back end. I want to add a debug exception (int3) to be generated >>> before any instance of certain x86 instructions. >>> >>> I tried to modify gcc/config/i386/i386.md by adding a "int3" to the >>> define_insn for instructions of interest. But that just caused >>> configure to fail (cannot run generated C programs). >>> >>> Any pointers on how to approach this? Also, suggestions for >>> alternative approaches are also welcome. >>> >>> Thanks! >>> >> >> Hi, >> >> Do you need the int3 specifically before those instructions? Or are you >> just looking to instrument the code and collect some information before >> those instructions are executed? Some alternative instrumentation tools you >> might look at to instrument existing code are: >> >> dyninst http://www.dyninst.org/ >> Valgrind http://valgrind.org/ >> Intel's Pin tool >> https://software.intel.com/en-us/articles/pin-a-dynamic-binary-instrumentation-tool >> >> -Will