[fpc-devel] I have created a openocd debugger-interface for lazarus, now some questions

Martin lazarus at mfriebe.de
Fri Feb 8 01:09:49 CET 2013


On 07/02/2013 23:51, Michael Ring wrote:
>
> Index: debugger/debugger.pp
> ===================================================================
> --- debugger/debugger.pp        (revision 40204)
> +++ debugger/debugger.pp        (working copy)
> @@ -3304,6 +3304,7 @@
>  const
>    OLD_GDB_DBG_NAME = 'GNU debugger (gdb)';
>    OLD_SSH_DBG_NAME = 'GNU debugger through SSH (gdb)';
> +  OLD_REMOTE_DBG_NAME = 'GNU debugger through OpenOCD (gdb)';

You should not need this.

Older versions of the IDE used those strings in the XML. But now the IDE 
uses the classname.

The 2 existing old names are kept so old config can be read.

There is no old config for your class.

>  var
>    s: String;
>  begin
> @@ -3314,6 +3315,7 @@
>      s := ConfigStore.GetValue('Type', '');
>      if s = OLD_GDB_DBG_NAME then FDebuggerClass:='TGDBMIDEBUGGER';
>      if s = OLD_SSH_DBG_NAME then FDebuggerClass:='TSSHGDBMIDEBUGGER';
> +    if s = OLD_REMOTE_DBG_NAME then 
> FDebuggerClass:='TOPENOCDGDBMIDEBUGGER';
see above

> Index: debugger/gdbmidebugger.pp
> ===================================================================
> --- debugger/gdbmidebugger.pp   (revision 40204)
> +++ debugger/gdbmidebugger.pp   (working copy)
> @@ -4502,8 +4502,12 @@
>        s := GetPart(['Thread '], [' '], R.Values, True);
>        Result := StrToIntDef(s, 0);
>        if Result <> 0 then exit;
> +
> +      // returned by openocd server
> +      s := GetPart(['* '], ['Remote target'], R.Values, True);
> +      Result := StrToIntDef(trim(s), 0);
> +      if Result <> 0 then exit;
>      end;

I'd rather factor all of the "get PID" code into a virtual method. (on 
the class TGDBMIDebuggerCommandStartDebugging)
Actually that might be the entire "RunToMain"

Then you can override it, and add there.

That means you have to subclass TGDBMIDebuggerCommandStartDebugging. See 
the GDBMIServerDebugger haw to do that


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130208/f4bc2891/attachment.html>


More information about the fpc-devel mailing list