Debugger Setup/es

From Free Pascal wiki
Jump to navigationJump to search

English (en) español (es) français (fr) русский (ru)

Configure the IDE

Para ser capaces de depurar los proyectos, es necesario asegurarse de tener el IDE correctamente configurado.

Estas configuraciones no cambian normalmente. Lo habitual es que se configuren una sola vez después de instalar Lazarus o bien si se cambia o actualiza la instalación.

Open the Lazarus option dialog: Dbg setup options1.png

La imagen muestra donde encontrar el diálogo de opciones en Lazarus 0.9.31 y posteriores (Herramientas -> Opciones). En versiones previas la entrada del menú se encontraba en "Entorno".


Dbg setup options2.png

  • Asegúrate de tener seleccionada la opción "GNU debugger (GDB)".
  • El trayecto hacia gdb.exe puede diferir:
    • En sistemas basados en Linux/Unix based suele ser algo así como "/usr/bin/gdb" Caso de no estar ver https://www.gnu.org

/software/gdb/ Paquete gdb.

En mi caso al instalar Lazarus 6.1 bajo Debian 8.3 no tenía instalado previamente gdb, así que instalé gdb (GNU Debugger)ofreciéndome disponible la versión 7.7.1, tendré que probar a compilar unos cuantos programas y ver que tal funciona. El instalador de paquetes también ofrece otro depurador gdb-arm-none-eabi para aquellos que lo requieran.

    • En Windows debería encontrarse en una carpeta llamada "mingw\bin\" bajo el directorio en el cual Lazarus se encuenta instalado.

Por ejemplo, en la instalción de Lazarus 1.6 bajo Windows se puede ver:

_________________________________________________________

  • GNU debugger through SSH (gdb)
    • C:\lazarus\mingw\bin\gdb.exe
    • /usr/bin/ssh user@remote /usr/bin/gdb

_________________________________________________________


  • GNU remote debugger (gdbserver)
    • /usr/bin/ssh user@remote /usr/bin/gdb
    • C:\lazarus\\mingw\i386-win32\bin\gdb.exe
    • C:\lazarus\\mingw\bin\gdb.exe
    • C:\lazarus\mingw\bin\gdb.exe

_________________________________________________________

  • GNU debugger (gdb)
    • $(LazarusDir)\mingw\$(TargetCPU)-$(TargetOS)\bin\gdb.exe
    • C:\lazarus\\mingw\i386-win32\bin\gdb.exe
    • C:\lazarus\\mingw\bin\gdb.exe
    • C:\lazarus\mingw\bin\gdb.exe

_________________________________________________________

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 considerably 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 are 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 0" ("Level 1" may be used, but in some cases may cause issues)
      Dbg setup project4.png

GDB Version

GDB 7.5 is not supported by Lazarus 1.0. It can be used with trunk only.

GDB 7.7.1 seems to work well with Lazarus 1.2.4.

See also

External links