[Lazarus] GDB problems (--exec-run)

Martin Frb lazarus at mfriebe.de
Wed Dec 18 14:34:04 CET 2013


On 18/12/2013 10:41, Torsten Bonde Christiansen wrote:
> Hi List.
>
> For some time now I am having problems getting GDB to work correctly 
> with Lazarus.
>
> Sometime, but not always, i run into the following message after I 
> terminate a program
> that I have debugged from within Lazarus:
>
> The GDB command:
> "-exec-run"
> returned the error:
> ",msg="During startup program exited normally.""
>
> The program runs fine but all debugging seems not to function 
> (breakpoints, etc.) when this
> happens.

This error can happen for various reasons. I have in the past heart of 
it in 2 cases:
1- certain position independent exe (PIE) : GDB fails to relocate 
certain breakpoints that Lazarus uses to start the exe (this is before 
any user breakpoints are set)
2- certain dll/so libraries, that define the same symbols as the main exe.

There may be more. The 2nd only happens on repeated runs of the debugger.

The IDE tries to work around those, but it does not always succeed. It 
is likely that in cases where it currently fails, this must be worked 
around by user set config (see below).

But it would be good if you could still send a logfile:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

Ways to work around: (all on the options / debugger page)

* In case 2 only:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working
> go to the debugger options 
> <http://wiki.lazarus.freepascal.org/IDE_Window:_Debugger_Options> and 
> in the field "debugger_startup_options" enter:
>
>         --eval-command="set auto-solib-add off" 
>
This can only be used, if you do not debug within libraries (if you have 
not written your own lib)

* In Case 2 only: Check "reset debugger after each run"
It will add a very slight increase to the time it takes to start the 
debugger, as gdb must be reloaded each time.

* In all cases:
Try any of the values available for "InternalStartBreak" (in the 
property grid of the options)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131218/bf856b92/attachment-0003.html>


More information about the Lazarus mailing list