I didn't do such debugging, but since Lazarus is compatible with GDB may be you can use such debugger. If I remember correctly it has a quite stable remote debugging system.Some more detail (I realize I was a bit cryptic in the first post):
=breakpoint-modified,bkpt={number="8",type="breakpoint",disp="keep",enabled="y",addr="0x000000000040021b",func="main",file="project1_linux_x86_64.pp",fullname="/home/christo/fpc/fpc-avr/src/examples/test/project1_linux_x86_64.pp",line="17",thread-groups=["i1"],times="1",original-location="/home/christo/fpc/fpc-avr/src/examples/test/project1_linux_x86_64.pp:17"}
~"\n"
~"Breakpoint 8, main () at project1_linux_x86_64.pp:17\n"
~"17\t c := test(a, b);\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="8",frame={addr="0x000000000040021b",func="main",args=[],file="project1_linux_x86_64.pp",fullname="/home/christo/fpc/fpc-avr/src/examples/test/project1_linux_x86_64.pp",line="17"},thread-id="1",stopped-threads="all",core="0"
(gdb)
<-data-disassemble -s 4194736 -e 4194737 -- 0>
=breakpoint-modified,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x0000011a",func="main",file="project1_avr.pp",fullname="/home/christo/fpc/fpc-avr/src/examples/test/project1_avr.pp",line="17",thread-groups=["i1"],times="1",original-location="/home/christo/fpc/fpc-avr/src/examples/test/project1_avr.pp:17"}
~"\nBreakpoint "
~"6, main () at project1_avr.pp:17\n"
~"17\t c := test(a, b);\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="6",frame={addr="0x0000011a",func="main",args=[],file="project1_avr.pp",fullname="/home/christo/fpc/fpc-avr/src/examples/test/project1_avr.pp",line="17"},thread-id="1",stopped-threads="all"
&"ptype A\n"
~"type = WORD\n"
^done
(gdb)
<whatis A>
&"whatis A\n"
~"type = WORD\n"
^done
(gdb)
<-data-evaluate-expression A>
^done,value="12090"
(gdb)
<-thread-info>
Is it correct for avr that the exe is loaded at very low addressed? 0x011a ?Yes, see attached disassembled source (project1_avr.lss.zip) for memory addresses.
DebuggerState: Finished dsRun
<< TCmdLineDebugger.ReadLn "(gdb) "
ERROR: Got NO stop params at all, but was running
The (what I think) is the expected output << TCmdLineDebugger.ReadLn "=breakpoint-modified,bkpt= only gets read on line 1057. DebuggerState: Finished dsRun
<< TCmdLineDebugger.ReadLn "=breakpoint-modified,bkpt=
INFO: TDBGDisassembler.FindRange: Address not found 282 wanted-before=15 wanted-after=17 in map with count=0
>> TCmdLineDebugger.SendCmdLn "-data-disassemble -s 42 -e 466 -- 0"
<< TCmdLineDebugger.ReadLn "^done,asm_insns=[{address="0x0080002a",inst="nop"},{address="0x0080002c",inst="nop"},
1) is a gdb issue, and probably not solvable from the IDE.I'm busy compiling gdb 8.0 with this patch (https://sourceware.org/ml/gdb-patches/2016-03/msg00318.html) for the avr_integer_to_address internal function which should correct the 0x800000 offset in program memory. Will test again once I get gdb running.
It may also lead to the IDE not understanding the result, and discarding it. (that is unlikely to get fixed in the IDE)
Thanks. Maybe add this here: http://wiki.lazarus.freepascal.org/Remote_DebuggingDone!
It would be nice to provide downloadable binaries, at least for your os and bitness :-[
- gdb 7.0.1 - Works
- gdb 8.0 - Doesn't work as is, but works with patch (https://sourceware.org/ml/gdb-patches/2016-03/msg00318.html).
It would be nice to provide downloadable binaries, at least for your os and bitness :-[Download link (https://github.com/ccrause/fpc-avr/tree/master/bin)...
Thank you! :DIt would be nice to provide downloadable binaries, at least for your os and bitness :-[Download link (https://github.com/ccrause/fpc-avr/tree/master/bin)...