Debug generated C code
Sometimes you need debug Eiffel generated C code, this is how to.
Contents
Unix
Edit $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include/config.sh and
- To the value of wkoptimize add the -g option.
- Replace the value of optimize to disable the C optimization (usually -O0) and add -g.
Once you have done that, do in your W_code or F_code directory:
- make clobber
- finish_freezing
Windows
After doing the changes below (depending on your C compiler), you can recompile your project from scratch and the debug information will be present.
MinGW
Edit $ISE_EIFFEL\studio\config\$ISE_PLATFORM\$ISE_C_COMPILER\config.eif and perform the following edits:
- Replace the content of optimize by -O0 -g.
- Replace the content of wkoptimize by -O0 -g.
Visual C++
Edit $ISE_EIFFEL\studio\config\$ISE_PLATFORM\$ISE_C_COMPILER\config.eif and perform the following edits:
- Replace the content of optimize' by -Od -Zi -MT.
- Search and replace all occurrences of -NODEFAULTLIB:libc by -NODEFAULTLIB:libc -DEBUG.
With Visual C++, you can have access to the Visual Studio C debugger which will let you attach Eiffel running processes. We certainly recommend that you catch all exceptions (Ctrl + Alt + E to get to the dialog).
If you have issues with Visual Studio not finding some debugging information, it might be necessary to tell Visual Studio where to find the associated PDB of your Eiffel executable or DLL.
Mac OS X
Hint: Eclipse works well to graphically debug your application, Xcode can be set up as well (more).
- Replace the content of optimize by -O0 -g.
- Replace the content of wkoptimize by -O0 -g.
Once you have done that, do in your W_code or F_code directory:
- make clobber
- finish_freezing
$(RM) $(OBJECTS)
With TextWrangler installed and a little shell script magic:
- edit `find -d . | grep "Makefile.SH"`
- Search -> Find ... -> Multi-File Search -> [x] Open Text Documents -> Search For: "$(RM) $(OBJECTS)" Replace With: "" -> Replace All