Or translate LazDebuggerFpGDBMI to use gdbserver.My preference is to move away from gdb since it needs a patch (which has been around since 2016) to work properly with the separate memory spaces of avr.
That should be easy, since it just needs to insert the commands to gdb that set the remote.... (and maybe async gdb commands)
If you want to control gdb-server without gdb, you need to implement everything that the gdb-part does. I.e. I do not know if gdb or gdb-server control the stepping.
Also a dwarf reader for the exe format involved.The elf format emitted by avr-ld is elf32-avr. Hopefully the current elf reader can correctly read little endian already...
Cpu specific register readerNot sure what this should do. The gdb remote protocol requires gdbserver support for register access.
Then it depends what is needed for running/stopping/pausing ....I think the disassembler is the best isolated bit and would be relatively easy to implement (e.g. the source for fp-avrsim is a good start, it already decodes the machine instructions, one only needs to output formatted text).
ASM single stepping should be fairly easy.
With look line based stepping can build on that, with an added (partial) disassembler... (with luck)
Some of that would go into FpDebug, and patches can be accepted.I think I'll start with the disassembler and see how things develop from there...
The protocol would go into a new backend.
---
Also there is no full support for memory spaces in fpdebug yet. There are one or 2 places where it has prepared code....
However that might not be to hard to change (adding bit offsets to addresses had turned out simple, so adding an address space would hopefully be similar)
I shall gladly answer any questions. (Though I will be away for about a week, after tomorrow).
As for reading elf32-avr. Should be easy to test.
components\fpdebug\test\dwarfviewer\dwarfviewer.lpi
You may need to changed some "missing" methods in fpdebug from protected to public (the compile error will tell).
Once compiled, open it, load the avr exe, and see if you see a list of units.
Select a unit, and show symbols (takes a bit of time).
If you get to see them, then that is good.
I have made a little progress on prototyping support for remote serial protocol (RSP) and AVR in FPDebugger.This is very nice news. Congratulations! If I didn't invest 20 years in AvrCo I would be hooked. ;)
wow... impressed.I assume you want to use qemu to emulate the AVR target? I use a simulator fp-avrsim (https://github.com/ccrause/fp-avrsim) to simulate the test program on the AVR target and act as gdbserver. Other options are available such as simavr.
Is there a way to set up a test env with qemu?
Is there a way to set up a test env with qemu?I don't see official AVR support mentioned in Qemu's wiki (https://wiki.qemu.org/Documentation/Platforms). There do appear to be some active development to support AVR (https://lore.kernel.org/qemu-devel/20191014161843.84845-2-mrolnik@gmail.com/) as a target.
Progress update: avr disassembler unit for testing (https://github.com/ccrause/lazarus/blob/master/components/fpdebug/fpdbgdisasavr.pp)
The disassembler can be tested with the asmtest program after applying this patch: https://github.com/ccrause/lazarus/commit/1efb5d1426a1443233122276367b8651353077f6
I'm trying to find a way to make AVR programs debug.https://wiki.freepascal.org/Creating_A_Patch#Applying_a_patch
but i fail even on the step "apply this patch to lazarus".
how can i make that?
< snip >
I'm trying to find a way to make AVR programs debug.
< snip >
Progress update: avr disassembler unit for testing (https://github.com/ccrause/lazarus/blob/master/components/fpdebug/fpdbgdisasavr.pp)I'm trying to find a way to make AVR programs debug.
The disassembler can be tested with the asmtest program after applying this patch: https://github.com/ccrause/lazarus/commit/1efb5d1426a1443233122276367b8651353077f6
but i fail even on the step "apply this patch to lazarus".
how can i make that?
Michael
... I'm busy updating the AVR and remote properties - if you like you can test this git branch: https://github.com/ccrause/lazarus/tree/fpdebugger-2021. Since this is still under development there may be a few issues, but of course if you find issues then please report them in this thread (not the bug tracker as this is still an out of tree fork).Just a note for those brave enough to test this branch - it has issues building with make because of dependencies not yet properly configured in the makefile and/or packages. Rebuilding this branch from inside an existing Lazarus IDE does work. Basically copy a working Lazarus executable into this source, open, configure compiler etc. and then click on Tools : Build Lazarus...
Just a note for those brave enough to test this branch - it has issues building with make because of dependencies not yet properly configured in the makefile and/or packages. Rebuilding this branch from inside an existing Lazarus IDE does work. Basically copy a working Lazarus executable into this source, open, configure compiler etc. and then click on Tools : Build Lazarus...The make issues should be fixed now (at least make all and make bigide works for me). Note that I started a new branch because there were a whole bunch of changes to reverse, and there were conflicts with upstream changes). The new branch: https://github.com/ccrause/lazarus/tree/fpdebugger-2021-2