[Lazarus] Switching debugger based on Project settings for embedded targets

Michael Ring mail at michael-ring.org
Wed Nov 21 17:34:38 CET 2018


Hi Martin, thank you for the detailled answer.

I like your idea of creating Id's for debugger configurations and as I 
want to go step by step (and I have great respect of 130kBytes of code 
in TEnvironmentOptions) I wanted to start small and grow as I go..... I 
am tempted to give the full refactoring a pass 8-) and prefer your option 2)

So I thought about how to create a usefull Id and came up with the 
following:

first part could be CRC16 of the Caption (to define the pricipal 
debugger Module that is used):

GNU debugger (gdb) --> 0x167E

GNU debugger through SSH (gdb) --> 0xB2AE

GNU remote debugger (gdbserver) --> 0x5579

GNU remote debugger via jlink (jlinkgdbserver) --> 0x463C


then add CRC16 of lowercase basename of gdb used:

gdb --> 0x84FD

mips-sde-elf-gdb -->0x7B4E

arm-none-eabi-gdb -->0xB5E7

and then we could add a CRC32 of all options changed from default (or 
CRC32 of all options)

so an id could look like this:

167E-84FD-FFFFFFFF for native debugger using gdb

5579-7B4E-FFFFFFFF for gdbserver using mips version of gdb

This would allow us to always select the right debugger module by 
looking at the first 4 chars, and for people working together there is a 
high chance that also the debugger part matches. We can of course fill 
this up to look like a propper UUID.....

That's already a reasonable starting point for a good configuration. We 
can tell the user (if we want to) that the debugger component used in 
the project cannot be found, we can also preconfigur the right debugger 
component when we find it and hint that the proper gdb is not jet 
configured.

Not perfect, but this hopefully already covers a number of usecases.

The real fun starts with also Checksumming the changes/all options, this 
allows us to pinpoint the exact configuration needed meaning that a 
developer will always get the perfect configuration for his own debug task.

I first thought to explicity checksum even more fields (like 
Debugger_Remote_Port) but as there is no way back from a checksum to an 
actual setting I think it does not add much more benefit.

What do you guys think?


Michael

Am 21.11.18 um 10:58 schrieb Dimitrios Chr. Ioannidis via lazarus:
> Hi,
>
> On 2018-11-20 23:44, Michael Ring via lazarus wrote:
>> What is the best way to implement this project based override, I guess
>> I can do the coding myself as I have also created my own debugger for
>> JLink, but I do not know how to do this debugger switching in the
>> proper 'Lazarus' way.....
>
>   I would like to be involved / help as I am thinking implementing the 
> mEDBG protocol and intergrate it to Lazarus to debug AVR MCU's using 
> this debugger https://hackaday.io/project/162372-xplained-yourself .
>
>   I already tried to use the avr-gdb --> avarice --> dragon --> 
> atmegaxxx combination ( which worked in Linux but not in Windows ) and 
> the result is that I have 3 bricked mcu's ( most probably by flashes 
> has been worn out by software breakpoints) . Not even the HVPP 
> procedure restore them.
>
>   Anyway if I can help ( and learn at the same time the Lazarus / 
> Debug internals ) that would be awesome.
>
> regards,
>


More information about the Lazarus mailing list