[Lazarus] Strange effect when debugging...

Michael Van Canneyt michael at freepascal.org
Fri Aug 2 19:03:38 CEST 2024



On Fri, 2 Aug 2024, Martin Frb via lazarus wrote:

> On 02/08/2024 17:53, Michael Van Canneyt via lazarus wrote:
>> 
>> Hi,
>> 
>> Does lazarus (or gdb) start a binary twice sometimes when initializing 
>> debugging ?
> ...
>> When I kill the prior process, the second F9 works at once, as do all other
>> attempts to run it.
>> 
>> But if I stop the IDE and restart it, I have the same behaviour again: 
>> first
>> attempt to run fails.
>> 
>> In the anchordockingdsgn IDE, when I switch project, run the new project 
>> and then return to the first project (which could not be debugged), all 
>> works again OK.
>> 
>> What is puzzling is that this only happens with the IDE that has 
>> anchordocking enabled.
>> If I recompile the IDE after removing the anchordocking package, debugging 
>> works
>> at once.
>
> I don't think it is the debugger (neither of them). Except, if the IDE would 
> internally start 2 instance of the debugger (then there would likely be mem 
> leaks on exit).
>
> I don't know if it is anything to do with ... but with anchordocking, I have 
> seen some keystrokes been send to the wrong control. The questions then would 
> be: Could a keystroke (F9) be duplicated? If the IDE received two times F9 in 
> a short enough time, would there be a race condition were the first is in 
> progress, but hasn't flagged the state internally, so the 2nd would also go 
> ahead?

Could very well be. I recently reported this:

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41041

The issue arises only when 2 IDE windows are open. The difference in
behaviour between the mouse and keyboard point indeed to the events 
ending up in the wrong place.

Seems to me that anchordocking in the IDE is not yet where it is supposed to
be... :-/

> (If that happens, and if that happens with the gdb backend, then there would 
> have to be 2 instances of gdb.exe running. Assuming that both runs were 
> triggered as "with debugger" and not one "without debugger")
>
> Otherwise maybe the output of the IDE to console does have hints.

I will try that and report back.

> ----
> Of course, I assume you ensured that before you tried to start, there wasn't 
> any old instance already.
> --

Obviously :-)

Michael.


More information about the lazarus mailing list