Difference between revisions of "Debug generated C code"

(Unix based platform)
Line 2: Line 2:
 
Sometimes you need debug Eiffel generated C codes, this is how to.
 
Sometimes you need debug Eiffel generated C codes, this is how to.
  
== Unix based platform ==
+
== Unix ==
 
Edit $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include/config.sh and
 
Edit $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include/config.sh and
 
#To the value of '''wkoptimize''' add the '''-g''' option.
 
#To the value of '''wkoptimize''' add the '''-g''' option.

Revision as of 10:10, 8 June 2009

Sometimes you need debug Eiffel generated C codes, this is how to.

Unix

Edit $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include/config.sh and

  1. To the value of wkoptimize add the -g option.
  2. 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:

  1. make clobber
  2. finish_freezing

Windows

You should first have Visual Studio installed.

There are two things you need to do before debugging generated C codes

Tell C compiler to add debug information

Change Eiffel C compilation config file "config.eif" (located at $ISE_EIFFEL\studio\config\win64\msc)

From

   optimize: "-Ox -MT"

To

   optimize: "-Od -Zi -MT 

Then you can start C compile in Eiffel projects with debugging information.

Tell linker to add debug information

After successfully C compilation and link, open command console, change directory to W_code (or F_code, using bottom right two buttons of C Output tool is easiest way)

In command console, run

   link @your_project_name.lnk -DEBUG

Please change "your_project_name" to your real project name. This will link your execution binary with debugging information. Make sure you are using Microsoft’s link.exe but not Cygwin's link.exe

Start debug C codes in Visual Studio

Now you can attach the Eiffel process in Visual Studio and debug. Don't forget to catch all exceptions in Visual Studio.

If you want to debug Eiffel generated DLL's C codes, when coping the DLL, you must copy the ".pdb" with the DLL together since ".pdb" file contains debugging information for Visual Studio.