Difference between revisions of "Debugger Setup"

From Lazarus wiki
Jump to navigationJump to search
Line 29: Line 29:
 
Please note: This will considerable increase the size of your executable ([[Lazarus_Faq#Why_are_the_generated_binaries_so_big.3F |See FAQ]]). If you want to build a release version of your software you should switch those settings off (see also [[IDE_Window:_Compiler_Options/de#Build_modes |Build Modes]])
 
Please note: This will considerable increase the size of your executable ([[Lazarus_Faq#Why_are_the_generated_binaries_so_big.3F |See FAQ]]). If you want to build a release version of your software you should switch those settings off (see also [[IDE_Window:_Compiler_Options/de#Build_modes |Build Modes]])
  
;The required settings can be made in the "Project Options" dialog:
+
The required settings can be made in the "Project Options" dialog:
[[image:Dbg_setup_project1.png]] [[image:Dbg_setup_project2.png]]  
+
<table><tr><td> [[image:Dbg_setup_project1.png]] </td><td> [[image:Dbg_setup_project2.png]] </td></tr></table>
  
 
* You must enable the "Generate Debug Info for GDB"
 
* You must enable the "Generate Debug Info for GDB"
** On Windows/Linux 32 bit it is highly recommended to use "Dwarf" [[image:Dbg_setup_project3.png]]
+
** On Windows/Linux 32 bit it is highly recommended to use "Dwarf" <br>[[image:Dbg_setup_project3.png]]
 
* You must <b>not</b> use any of the following
 
* You must <b>not</b> use any of the following
 
** "Strip Symbols"
 
** "Strip Symbols"
 
** "Link Smart"
 
** "Link Smart"
** Any optimization other than "Level 1" (or "Level 0") [[image:Dbg_setup_project4.png]]  
+
** Any optimization other than "Level 1" (or "Level 0") <br>[[image:Dbg_setup_project4.png]]  
  
  

Revision as of 14:04, 2 October 2011

Configure the IDE



In order to be able to debug any of your projects, you need to make sure a the IDE is correctly configured.

This settings do not usually change. You need to make them only once after you installed Lazarus, or if you changed/updated your installation

Open the Lazarus option dialog

Dbg setup options1.png

The image shows, where to find the option dialog in the Lazarus 0.9.31 and up. In previous versions the entry is in the "Environment" menu.


Dbg setup options2.png

  • Make sure, the option "Gnu debugger (GDB)" is selected.
  • The path to the gdb.exe may differ.
    • On unix based systems it may be something like "/usr/bin/gdb"
    • On windows it should be in a folder called "mingw\bin\" in the directory in which Lazarus is installed.

Project Options



In order to debug your project, you need to tell the IDE to compile it in a special way, which provides additional information required by the debugger.

Please note: This will considerable increase the size of your executable (See FAQ). If you want to build a release version of your software you should switch those settings off (see also Build Modes)

The required settings can be made in the "Project Options" dialog:

Dbg setup project1.png Dbg setup project2.png
  • You must enable the "Generate Debug Info for GDB"
    • On Windows/Linux 32 bit it is highly recommended to use "Dwarf"
      Dbg setup project3.png
  • You must not use any of the following
    • "Strip Symbols"
    • "Link Smart"
    • Any optimization other than "Level 1" (or "Level 0")
      Dbg setup project4.png


See also



GDB_Debugger_Tips