<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 18/12/2013 10:41, Torsten Bonde
Christiansen wrote:<br>
</div>
<blockquote cite="mid:52B17BE5.5000509@epidata.info" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<font face="monospace">Hi List.<br>
<br>
For some time now I am having problems getting GDB to work
correctly with Lazarus.<br>
<br>
Sometime, but not always, i run into the following message after
I terminate a program<br>
that I have debugged from within Lazarus:<br>
<br>
The GDB command:<br>
"-exec-run"<br>
returned the error:<br>
",msg="During startup program exited normally.""<br>
<br>
The program runs fine but all debugging seems not to function
(breakpoints, etc.) when this<br>
happens.</font><br>
</blockquote>
<br>
This error can happen for various reasons. I have in the past heart
of it in 2 cases:<br>
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)<br>
2- certain dll/so libraries, that define the same symbols as the
main exe.<br>
<br>
There may be more. The 2nd only happens on repeated runs of the
debugger.<br>
<br>
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).<br>
<br>
But it would be good if you could still send a logfile: <br>
<a class="moz-txt-link-freetext" href="http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session">http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session</a><br>
<br>
Ways to work around: (all on the options / debugger page)<br>
<br>
* In case 2 only:<br>
<a class="moz-txt-link-freetext" href="http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working">http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working</a><br>
<blockquote type="cite">go to the <a
href="http://wiki.lazarus.freepascal.org/IDE_Window:_Debugger_Options"
title="IDE Window: Debugger Options">debugger options</a> and in
the field "debugger_startup_options" enter:
<dl>
<dd>
<dl>
<dd> --eval-command="set auto-solib-add off"
</dd>
</dl>
</dd>
</dl>
</blockquote>
This can only be used, if you do not debug within libraries (if you
have not written your own lib)<br>
<br>
* In Case 2 only: Check "reset debugger after each run"<br>
It will add a very slight increase to the time it takes to start the
debugger, as gdb must be reloaded each time.<br>
<br>
* In all cases:<br>
Try any of the values available for "InternalStartBreak" (in the
property grid of the options)<br>
<br>
<br>
<br>
</body>
</html>