jtag debugging on avr with avr-gdb and ddd

294 Views Asked by At

I try to debug with jtag on an AVR 8 bit microcontroller.

avarice --jtag /dev/ttyUSB0 :4444

ddd lcd --debugger avr-gdb

in the session I do:

target remote localhost:4444

break main

Breakpoint 1 at 0x244: file lcd_test.cpp, line 254.

cont

Now the target stops and pc is correct:

But if I look at assembly code window, I have an offset of 0x800000 and the wrong content:

Dump of assembler code from 0x800244 to 0x800344:

0x00800244:  ldd     r1, Y+16        ; 0x10
0x00800246:  std     Z+8, r0 ; 0x08
0x00800248:  sbc     r8, r16
0x0080024a:  xch     Z, r16
0x0080024c:  .word   0x0018  ; ????
0x0080024e:  eor     r1, r0

In native avr-gdb with layoit asm everything looks fine.

Any idea how to get the correct output from assembly window in DDD in connection with avr-gdb?

1

There are 1 best solutions below

0
Klaus On

This is an very old bug in gdb! It was reported already in 2011. The bug report contains a patch which can be applied to current gdb version 9.1 and works as expected!

Also ddd must be patched with:

diff -ur ddd-3.3.12/ddd/GDBAgent.C ddd-3.3.12_patched/ddd/GDBAgent.C
--- ddd-3.3.12/ddd/GDBAgent.C   2009-02-11 18:25:06.000000000 +0100   
+++ ddd-3.3.12_patched/ddd/GDBAgent.C   2014-05-20 09:49:46.147850710 +0200
@@ -3200,7 +3200,8 @@
   {
     string end_( end );
     normalize_address(end_);
-   cmd += ' ';
+    cmd += ',';
+    cmd += ' '; 
cmd += end_;
 }
 return cmd;

After the changes ddd with avr-gdb works.