[Lazarus] Some issues with openocd and gdbmidebugger

Martin Frb lazarus at mfriebe.de
Sun May 10 16:01:49 CEST 2015


This is the GDBMIServerDebugger?

On 10/05/2015 14:08, Michael Ring wrote:
> After the breakpoint for main is set and -exec-continue is called (I tried both the async and not async version):
> @@ -5007,15 +5030,20 @@
>         // RUN
>         DefaultTimeOut := 0;
> -      if not ExecuteCommand(Cmd, R, [cfTryAsync])
> +//      if not ExecuteCommand(Cmd, R, [cfTryAsync])
> +        if not ExecuteCommand(Cmd, R)
There is' a flag, in the debugger-properties, to allow/disallow async.
I have to chack, but IIRC:
- in GDBMIDebugger it is not set, so the flag is always ignored. (and it 
may not be published, so not editable)
- In GDBMIServerDebugger it is set (and published)

Try to unset async in config.

> the debugger comes back with the (gdb) prompt before the stop at the breakpoint.
That should be normal. "run" or "continue" (any run command) has 2 
prompts in return.

1st prompt => acknowledges the command (the state changes to run)
2nd prompt => should be after state changed to stopped, ready for next 
command.

In async mode it is more tricky, because one prompt (IIRC the 2nd) may 
(sometimes) be missing.
It makes sense, as in async mode, gdb takes input while running.


> This confuses StartDebugging, the next thing is tries is to remove the breakpint, this fails because the debugger thinks the process is still running.
>
> I checked with gdb directly connected, there the output in non-async mode looks good:
>
> (gdb) break main
those are none MI commands. They may behave different.

use "gdb -i mi" and then the gdbmi commands

> Here's the output of lazarus with debugging turned on:
>
>   >> TCmdLineDebugger.SendCmdLn "-exec-continue"
>   << TCmdLineDebugger.ReadLn "~"Note: automatically using hardware 
> breakpoints for read-only addresses.\n""
>   << TCmdLineDebugger.ReadLn "^running"
>   << TCmdLineDebugger.ReadLn "*running,thread-id="all""
>   << TCmdLineDebugger.ReadLn "(gdb) "
>
>
>   >> TCmdLineDebugger.SendCmdLn "-break-delete 2"
>   << TCmdLineDebugger.ReadLn "@"WARNING! The target is already 
> running. All changes GDB did to registers will be discarded! Waiting 
> for target to halt.\n""
odd...
Please add

       // RUN
       DefaultTimeOut := 0;
       if not ExecuteCommand(Cmd, R, [cfTryAsync])
       then begin
         SetDebuggerErrorState(Format(gdbmiCommandStartMainRunError, 
[LineEnding]),
                               ErrorStateInfo);
         exit;
       end;
////ADD ////////////////////////<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
debugln(['After RUN ',dbgs(r.State)]);

----------------------------------------------------------

and log with

--debug-log=LOG_FILE 
--debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO,DBG_VERBOSE,DBG_EVENTS,DBG_STATE_EVENT

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


More information about the Lazarus mailing list