Debugging Eiffel Applications with gdb

Linux, gcc

- Before starting EiffelStudio, set 'CFLAGS' to add debugging information to the generated files:

export CFLAGS='-g -pipe'
  • Clean the project and build it again.
  • Now, the generated executable should contain debugger symbols. It can be debugged with gdb or ddd (Data Display Debugger).

To see the mapping between Eiffel classes and features to C files and their methods, the file 'TRANSLAT' in the 'W_code' directory is very useful.


Debugging the Application and parts of the runtime

To be able to debug parts of the runtime, too, it's necessary to build the run-time with debugging symbols included.

  • First the CFLAGS need to be set accordingly:
export CFLAGS='-O0 -g3 -pipe'
  • Build the run-time the first time:
geant -b $EIFFEL_SRC/scripts/build.eant compile_runtime


  • Then the makefile of the run-time needs to be changed to make sure that the run-time is built without optimizations. The optimizations make debugging quite hard, as the program flow doesn't follow the original one from the source code. In the file $EIFFEL_SRC/C/run-time/Makefile, replace 'O3' by 'O0' in the lines that start with JCFLAGS and JMTCFLAGS.
  • Rebuild the run-time:
cd $EIFFEL_SRC/C/run-time
make clean
make
  • Make sure that the Eiffel delivery you use for building the application uses the modified binaries of the runtime. Either copy the *.a, *.so files from $EIFFEL_SRC/C/run-time to ($ISE_EIFFEL/studio/spec/$ISE_PLATFORM/lib/) or link them to that directory.
  • Build your application (of course with debugging symbols).
  • Happy debugging!