Debugger Setup

This is an old revision of Debugger Setup, edited by Martin at . The current revision is 77146.

/* Project Options */

Configure the IDE

Updating from an older IDE

Older versions of Lazarus were only providing the GdbMI backend. It is highly recommended to update to Fp-Debugger or LLDB+FpDebug as indicated for your OS below.

Please note that many other wiki pages may be outdated and still refer only to GDB.

Choosing the correct debugger backend

The Lazarus IDE provides several debuggers (backends). The page Status of the debugger backends provides an overview.

The list below indicates which backend is recommended for your environment.

Operating System Hardware Recommended debugger backend Recommended debug info Notes
Windows 32/64bit Intel/AMD i386 or x86_64 Fp-Debugger DWARF-3 Includes cross debugging of a 32bit app on a 64bit system
Windows 32bit Cross 64bit Intel/AMD x86_64 GdbMi DWARF-2 with sets Only cross debugging of a 64bit app on a 32bit system
Windows ARM / AArch64 / other GdbMi DWARF-2 with sets You may also try "GdbMI+FpDebug"
Linux Intel/AMD i386 or x86_64 Fp-Debugger DWARF-3 If RTL or packages have debug info, ensure it is the exact same type as for the project
Linux ARM / AArch64 / other GdbMi DWARF-2 with sets You may also try "GdbMI+FpDebug"
Mac Intel/AMD x86_64 AArch64 (e.g. M1) LLDB+FpDebug DWARF-3
Embedded AVR FpDebug-avr package DWARF-2 or 3 Requires gdb server
Remote Any supported by GDB Gdb-Server DWARF-2 with sets Debugging on a different PC or VM
Other Any supported by GDB GdbMi DWARF-2 with sets
Any OS Debug with STDIN/STDOUT redirect (via "Run Parameters" command line: >file < file) Any supported by GDB GdbMi DWARF-2 with sets

Setting up the debugger backend for the IDE

The following settings should be made once, after you installed Lazarus. They are often already set by default.

The settings can be found under

Tools > Options > Debugger > Debugger Backend

The image shows where to find the option dialog. On Mac the dialog is under "Preferences"

The backend can also be set on a per project config. For details see IDE_Window:_Project_Options_-_Debugger_Backend

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.

The required settings are made in the "Project Options" dialog:



You can use the "Build modes". The "..." button brings of a dialog to create "release and debug mode". In this case you should still check the "Type of debug info".

GDB / LLDB Version

GDB 7.5 requires Lazarus 1.4 or higher.

GDB 7.7.1 seems to work well with Lazarus 1.2.4.

On macOS: lldb is part of the Apple developer tools

See also