Difference between revisions of "IDE Window: Debugger Options"

From Free Pascal wiki
Jump to navigationJump to search
m (Reverted edits by Kissablemaiden (Kissablemaiden); changed back to last version by Swen)
(25 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[category:IDE Window|Debugger Options]][[category:IDE Window - Configuration|Debugger Options]][[category:IDE Window - Debug|Options]]
+
<noinclude>{{IDE Window: Debugger Options}}<!--- This page may be used as template in other pages ---></noinclude>
{{IDE Window: Debugger Options}}
 
  
 
== General ==
 
== General ==
 +
This article describes the settings in the Tools/Options menu related to debugging.
 +
 +
In Lazarus 2.2 this frame was replaced by [[IDE_Window:_DebuggerGeneralOptionsFrame|Debugger General Options]] and [[IDE_Window:_DebuggerClassOptionsFrame|Debugger Backend Options]]
 +
 
<center>[[Image:Debugger_options_general.png]]</center>
 
<center>[[Image:Debugger_options_general.png]]</center>
  
 
=== Debugger type and path ===
 
=== Debugger type and path ===
 
 
Choose the debugger.  
 
Choose the debugger.  
* '''None''' - No debugger. On Run, simply execute the program.
+
;None: No debugger. On Run, simply execute the program.
* '''GNU debugger (gdb)''' - The gdb is not part of Lazarus. Unles you are using windows, you must install it yourself.  
+
;[[LazDebuggerFp|FpDebug internal Dwarf-debugger]]:
This is the connector to gdb. You must set the path to gdb (for example /usr/bin/gdb) in the field below.
+
;GNU debugger (gdb): [[GDB]] is not a part of Lazarus. Unless you are using Windows or macOS with Xcode, you must install it yourself. This is the connector to gdb. You must set the path to gdb (for example /usr/bin/gdb) in the field below.
* '''GNU debugger through SSH''' - for remote debugging. You can use a SSH connection to a another computer and execute gdb there. You need a SSH connection without prompt for password for this. See the SSH documentation on how to do that.
+
;GNU debugger through SSH: for remote debugging. You can use an SSH connection to another computer and execute gdb there. You need a SSH connection without prompt for password for this. See the SSH documentation on how to do that. This feature has certain limits. [[Remote_Debugging|Read more ...]]
 +
;GDB remote debugger (gdbserver): for remote debugging.
 +
;LLDB Debugger (Alpha):
 +
;LLDB Debugger (with fpdebug) (beta):
  
 
=== Additional search path ===
 
=== Additional search path ===
 
 
You can add extra directories, where to search for sources, named in the debugging information of the executable. This is used for all projects.
 
You can add extra directories, where to search for sources, named in the debugging information of the executable. This is used for all projects.
  
 
=== Debugger general options ===
 
=== Debugger general options ===
 
+
;Show message on stop: Enable this to show a notification, when programs stops.
==== Show message on stop ====
+
;Reset debugger after each run: The IDE keeps GDB running and re-uses it. If you are using a (older) version of GDB that does not support this, then you can start a new GDB instance each time you start a debug session.
 
 
Enable this to show a notification, when programs stops.
 
  
 
=== Debugger specific options ===
 
=== Debugger specific options ===
 +
Each debugger type has special options.
  
Each debugger type has special options.
+
==== FpDebug internal Dwarf-debugger ====
 +
;NextOnlyStopOnStartLine:
  
 
==== GNU debugger (gdb) ====
 
==== GNU debugger (gdb) ====
 
+
;Debugger_Startup_Options: Pass extra arguments to GDB. This is not needed for normal usage. This is if you are familiar with GDB and wish to modify it's behaviour. Using this option may interfere with the proper working of the debugger
* '''OverrideRTLCallingConvention''':
+
;DisableLoadSymbolsForLibraries: Prevent loading any symbols from libraries. (Must not be used, if debugging libraries). There are several gdb issues triggered by symbols loaded from libraries. If you get any error mention "solib", try setting this to true. Also see: [[GDB_Debugger_Tips#Known_Problems_.2F_Errors_reported_by_the_IDE]]
This is an internal flag and can stay default.
+
;EncodeCurrentDirPath/EncodeCurrentFilePath: Experimental. Those option affect the quoting of certain path/filenames when they are given to GDB. Changing the option to the wrong value will stop the debugger from working.
To handle software exceptions, Lazarus uses some internal breakpoints on locations where these exceptions are raised. When an executable is fully compiled with debug info (thus also the RTL) one can retrieve the agruments passed to those exception routines. However that is usually not the case, so Lazarus has its internal way of examinig the callstack and registers. In order to interprete those arguments correctly it needs to know what the internal calling convention was of those routines. Pre FPC 1.9.x arguments were passed on stack. Nowadays arguments are passed in registers.
+
;InternalStartBreak: Changes the way the debugger detects your applications, main entry point. It is advised to leave this at default. Other values may be tried, if the debugger report an error "<i>The debugger could not set a breakpoint on the application''s entry point</i>".
In case the the FPC version detection routine draws the wrong conclusion, one can override the calling convention here.
+
;MaxDisplayLengthForString: For any string (pchar) gdb reads a maximum as specified by this setting. GDB always terminates at the 1st zero. GDB does not really handle pascal strings well.
 +
;UseAsyncCommandMode: Mainly supported by gdbserver. Setting should be used for any remote debugging (gdbserver/gdb over ssh). See gdb documentation for "set target async". IF supported by gdb, can also be used for local debugging.
 +
;WarnOnInternalError: Default true. If set to False, internal errors by gdb will be ignored by the IDE. Yet that does not change, that gdb did have an internal error, and that debugging may report incorrect data, or dis-behave in anyway. Neither will it prevent follow up error. It simple skips informing the user, yet fixes nothing. Leave on true, unless you get repeatedly the same internal error, and have tested well, that it does not affect you. (Then the warning dialog would be annoying, and you may want to skip it)
 +
;TimeOutForEval/WarnOnTimeOut: Read [[GDB_Debugger_Tips#TimeOuts]]
  
 
== Event Log ==
 
== Event Log ==
Line 38: Line 45:
  
 
=== General ===
 
=== General ===
 
 
Eventually logging info should go the the [[IDE Window:Event Log|event log]], for now it is show in the [[IDE Window: Debug Output|debug output]] window.
 
Eventually logging info should go the the [[IDE Window:Event Log|event log]], for now it is show in the [[IDE Window: Debug Output|debug output]] window.
  
Line 45: Line 51:
  
 
=== Messages ===
 
=== Messages ===
(not implemented)
+
The Messages window is usually positioned below the source editor and shown, when building the project. It shows the compiler output and can show the output of external tools.
 +
 
 +
[[File:IDEMessagesWindowFind1.png]]
  
This controls which messages are logged in the event log
+
See [[IDE_Window:_Messages|IDE Window: Messages]].
  
 
== Language Exceptions ==
 
== Language Exceptions ==
Line 55: Line 63:
  
 
=== Ignore these exceptions ===
 
=== Ignore these exceptions ===
 
 
Add your exceptions to ignore here.
 
Add your exceptions to ignore here.
 
For example: EDivByZero
 
For example: EDivByZero
  
 
=== Break on Lazarus Exceptions ===
 
=== Break on Lazarus Exceptions ===
 
 
Uncheck this option if you don't want to stop on any exception
 
Uncheck this option if you don't want to stop on any exception
  
Line 70: Line 76:
  
 
Defines if signals should be handled by the debugger or by the user program. For instance, an div by zero is first signalled by the OS. Then the FPC RTL translates this to an EDivByZero. When the signal is handled by the debugger, the program is stopped before the RTL translates this message. Currently the debugger always stops on a signal.
 
Defines if signals should be handled by the debugger or by the user program. For instance, an div by zero is first signalled by the OS. Then the FPC RTL translates this to an EDivByZero. When the signal is handled by the debugger, the program is stopped before the RTL translates this message. Currently the debugger always stops on a signal.
 +
 +
== See also ==
 +
* [[Debugger Setup]]

Revision as of 20:12, 12 October 2020

Deutsch (de) English (en) español (es) français (fr) português (pt) русский (ru)

General

This article describes the settings in the Tools/Options menu related to debugging.

In Lazarus 2.2 this frame was replaced by Debugger General Options and Debugger Backend Options

Debugger options general.png

Debugger type and path

Choose the debugger.

None
No debugger. On Run, simply execute the program.
FpDebug internal Dwarf-debugger
GNU debugger (gdb)
GDB is not a part of Lazarus. Unless you are using Windows or macOS with Xcode, you must install it yourself. This is the connector to gdb. You must set the path to gdb (for example /usr/bin/gdb) in the field below.
GNU debugger through SSH
for remote debugging. You can use an SSH connection to another computer and execute gdb there. You need a SSH connection without prompt for password for this. See the SSH documentation on how to do that. This feature has certain limits. Read more ...
GDB remote debugger (gdbserver)
for remote debugging.
LLDB Debugger (Alpha)
LLDB Debugger (with fpdebug) (beta)

Additional search path

You can add extra directories, where to search for sources, named in the debugging information of the executable. This is used for all projects.

Debugger general options

Show message on stop
Enable this to show a notification, when programs stops.
Reset debugger after each run
The IDE keeps GDB running and re-uses it. If you are using a (older) version of GDB that does not support this, then you can start a new GDB instance each time you start a debug session.

Debugger specific options

Each debugger type has special options.

FpDebug internal Dwarf-debugger

NextOnlyStopOnStartLine

GNU debugger (gdb)

Debugger_Startup_Options
Pass extra arguments to GDB. This is not needed for normal usage. This is if you are familiar with GDB and wish to modify it's behaviour. Using this option may interfere with the proper working of the debugger
DisableLoadSymbolsForLibraries
Prevent loading any symbols from libraries. (Must not be used, if debugging libraries). There are several gdb issues triggered by symbols loaded from libraries. If you get any error mention "solib", try setting this to true. Also see: GDB_Debugger_Tips#Known_Problems_.2F_Errors_reported_by_the_IDE
EncodeCurrentDirPath/EncodeCurrentFilePath
Experimental. Those option affect the quoting of certain path/filenames when they are given to GDB. Changing the option to the wrong value will stop the debugger from working.
InternalStartBreak
Changes the way the debugger detects your applications, main entry point. It is advised to leave this at default. Other values may be tried, if the debugger report an error "The debugger could not set a breakpoint on the applications entry point".
MaxDisplayLengthForString
For any string (pchar) gdb reads a maximum as specified by this setting. GDB always terminates at the 1st zero. GDB does not really handle pascal strings well.
UseAsyncCommandMode
Mainly supported by gdbserver. Setting should be used for any remote debugging (gdbserver/gdb over ssh). See gdb documentation for "set target async". IF supported by gdb, can also be used for local debugging.
WarnOnInternalError
Default true. If set to False, internal errors by gdb will be ignored by the IDE. Yet that does not change, that gdb did have an internal error, and that debugging may report incorrect data, or dis-behave in anyway. Neither will it prevent follow up error. It simple skips informing the user, yet fixes nothing. Leave on true, unless you get repeatedly the same internal error, and have tested well, that it does not affect you. (Then the warning dialog would be annoying, and you may want to skip it)
TimeOutForEval/WarnOnTimeOut
Read GDB_Debugger_Tips#TimeOuts

Event Log

Debugger options eventlog.png

General

Eventually logging info should go the the event log, for now it is show in the debug output window.

  • Clear log on run: clear the event log, on each start of the program.
  • Limit line count to: keep only the last lines of output.

Messages

The Messages window is usually positioned below the source editor and shown, when building the project. It shows the compiler output and can show the output of external tools.

IDEMessagesWindowFind1.png

See IDE Window: Messages.

Language Exceptions

Debugger options language exceptions.png

Programs can raise exceptions. For example, when a file can not be read. Here you setup, if the debugger should stop on an exception.

Ignore these exceptions

Add your exceptions to ignore here. For example: EDivByZero

Break on Lazarus Exceptions

Uncheck this option if you don't want to stop on any exception

OS Exceptions

Debugger options os exceptions.png

Signals

(not implemented)

Defines if signals should be handled by the debugger or by the user program. For instance, an div by zero is first signalled by the OS. Then the FPC RTL translates this to an EDivByZero. When the signal is handled by the debugger, the program is stopped before the RTL translates this message. Currently the debugger always stops on a signal.

See also