[Lazarus] Remote debugger looses connection to target on Windows 7

Martin Frb lazarus at mfriebe.de
Thu Apr 10 14:33:00 CEST 2014

On 10/04/2014 12:28, Bernd Mueller wrote:
>> You could try, if you are on that line, instead of stepping (F8), set 
>> a breakpoint the next line (lines, if there is a conditional), and 
>> use F9.
>> Then, with F9 you should be able to use the pause button
>>>> And then try, what happens if you hit the pause button in the IDE?
> yes, pause seems to work.
>> So the remote printed connection lost, when you pressed stop in the 
>> IDE. Then it was still connected?
> The exact message from the target is:
> "Remote side has terminated connection. GDBServer will reopen connection.
> Listening on port 3333"

Well from the log, there is nothing wrong in the IDE <-> gdb 
communication. So it is some issue in GDB itself.

As for trying to find a workaround:

If gdb server can detect the connection loss (at "stop"), then it was 
still connected. So gdb has failed on a different level. I assume that 
the gdbserver on the arm target is the same, when you try from win7, as 
it is when you try from win2000?

Maybe something with the AV or firewall on win7?
Maybe trying a different version of gdb on win7?

gdbserver seems to have some options to track problems, maybe try them?
> Options:
>   --debug               Enable general debugging output.
>   --remote-debug        Enable remote protocol debugging output.

You can also try the following.

1.3:   components\lazdebuggergdbmi\gdbmidebugger.pp  (line 877)
1.2:   debugger\gdbmidebugger.pp    (line ??)

defines a "const"
   GDBMIExecCommandMap: array [TGDBMIExecCommandType] of string =

       '-exec-next',               // ectStepOver,

replace it by
       'n',               // ectStepOver,

Rebuild the IDE. Then in the log, watch out for
   >> TCmdLineDebugger.SendCmdLn "n &"

If the next line is an error (like)
   << TCmdLineDebugger.ReadLn "^error,msg="A syntax error in expression, 
near `&&'.""

Then it does NOT help.
If it is followed by
   << TCmdLineDebugger.ReadLn "^running"

then wait till the error happens, and see what happens if you press pause.

Though, yes, it will not stop the error from happening. But it may allow 
pause to work, if the error happens.

Fixing the error, can probably only be done in gdb

More information about the Lazarus mailing list