[Lazarus] Gdb and openocd via lazarus

Michael Ring mail at michael-ring.org
Wed May 28 13:57:03 CEST 2014


If I were you I would try to start as low-level as possible.

To do  so, please check if your gdb is configured with textui enabled ( 
try starting it with arm-none-eabi-gdb --tui )

if only commandline shows up then download gdb and recompile it:

cd  gdb
./configure--target=arm-none-eabi--prefix=/usr/local  --program-prefix=arm-none-eabi---disable-werror --enable-tui


This Text UI is very nice for finding out if the problem is related to 
gdb or to the integration of gdb into the ide.

Here's how I call gdb:

arm-none-eabi-gdb hello.elf --tui --eval-command="target extended :3333" 
--eval-command="monitor reset halt" --eval-command="set mem 
inaccessible-by-default off" --eval-command="load"


This loads the binary, you should end up with the debugger showing you 
your source code.

Now try stepping through the code, if all is fine then great, problem is 
in the integration of gdb.

Stept I use:
break main
cont

step

When stepping does not work you can go deeper:

add

--eval-command="layout asm" --eval-command="layout regs"

to the commandline and start over, now you can single step through the 
assembler code with

stepi

This should help you to track down your problems (I hope)

Michael

Am 28.05.14 12:36, schrieb Koenraad Lelong:
> op 21-05-14 20:17, Martin Schreiber schreef:
>
>>
>> In MSEide the procedure is as follows - I assume same as in Lazarus:
>> In 'Start gdb server command run target' write the command or script 
>> which
>> starts the OpenOCD gdb proxy server (I don't know the command).
>> Set 'Wait before connect' to the GDB server startup time + some reserve.
>> 'Target connection' = remote localhost:3333
>>
>> Activate 'gdb download' then MSEide will use the gdb "load" command for
>> program download.
>>
>> I suggest to make first a minimal C-program with the gcc toolchain of 
>> your
>> target. If that works the FPC adventure can start. ;-)
>>
>> Martin
>>
> Hi,
>
> I tried to debug my arm-board with MSEide.
> I manually started openocd (I need to be root). I configured MSEide 
> debugger : Target connection : extended-remote localhost:3333.
> I configured debug-target to the elf-file of my project. Is there a 
> macro to add an extention to the "make-output-file" ?
> I compiled the project and manually flashed it, and I left it in reset 
> halt.
> I then can attach to the target, I see gdb connecting to openocd. I 
> get the proper source in the source window. I can start the project, 
> but since there seems still a problem with the compile-fase (the 
> resulting binary does not work properly) I tried to reset the board. 
> There gdb drops the connection to the target.
>
> When I set a breakpoint, the target halts, but MSEide does not 
> indicate in the source where it stops. I can step, but again MSEide 
> does not follow in the source.
>
> I can "continue" the target and stop it. But when I stop it, no 
> indication where in the source it stopped.
>
> So progress, but not there yet. Or maybe I'm doing things wrong ?
>
> I still need to find why the binary is not good. When I compile the 
> project via cli, it's working. From within MSEide, it does not work, 
> although the command-line is the same as my manual command-line. I 
> will add -va again and compare the outputs.
>
> Koenraad.
>
> -- 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140528/64ccbd26/attachment-0003.html>


More information about the Lazarus mailing list