View Disassembly in Eclipse Debugger

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to set up an Eclipse workspace to do debugging on the GNU AVR simulator.  When I launch the debugger, everything seems to work except the disassembly view.  At the top, I get the following message:

 

Failed to execute MI command:
          -data-disassemble -s 0 -e 47 -- 3
          Error message from debugger back end:
          Cannot access memory at address 0x40000

 

Then for every line I get a message:

 

Unable to retrieve disassembly data from backend.

 

Has anyone run into this?  What is the solution?

 

I'm using Eclipse 2019-12 with the Eclipse-AVR plugin 2.4.1, Eclipse CDT 9.9, MCU Tools 0.5, and avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.2_1759) 5.4.0.

 

Thanks!

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

radiorun wrote:
GNU AVR simulator
GNU simulator??!? What? Where?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GDB in the GNU AVR toolchain has a simulator built-in. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

radiorun wrote:
GDB in the GNU AVR toolchain has a simulator built-in. 
Err, no, it doesn't.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(gdb) help target
Connect to a target machine or process.
The first argument is the type or protocol of the target machine.
Remaining arguments are interpreted by the target protocol.  For more
information on the arguments for a particular protocol, type
`help target ' followed by the protocol name.

List of target subcommands:

target core -- Use a core file as a target
target exec -- Use an executable file as a target
target extended-remote -- Use a remote computer via a serial line
target record -- Log program while executing and replay execution from log
target record-btrace -- Collect control-flow trace and provide the execution history
target record-core -- Log program while executing and replay execution from log
target record-full -- Log program while executing and replay execution from log
target remote -- Use a remote computer via a serial line
target sim -- Use the compiled-in simulator
target tfile -- Use a trace file as a target

Type "help target" followed by target subcommand name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Surely that help is generic? It's saying that if the target has a sim that's the way to invoke it.

 

It's true that there's two different things called "simulavr" that can be interface to GDB as a simulation backend for avr-gdb but avr-gdb itself does not contain an AVR simulator (unless this is a VERY recent addition??)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it doesn't, then it does a fake out and appears to work anyway.  I can single step through the code just fine. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is AVR interpreter code in the gdb source.  It was added back in 2009:

 

commit df1756f414a26ac33aa2d0dbe6d757e214e45419                                                                        

Author: Tristan Gingold <gingold@adacore.com>                                                                          

Date:   Mon Apr 27 10:50:53 2009 +0000                                                                                                                                                                                                             

2009-04-27  Tristan Gingold  <gingold@adacore.com>                                                                                                                                                                                                     

            * avr: New directory.                                                                                                  

            * avr/interp.c, avr/Makefile.in, avr/configure.ac: New files.
            * avr/config.in: New file, generated by autoheader.
            * avr/configure: New file generated by autoconf.
            * configure.ac: Add avr.
            * configure: Regenerated.

 

/* Simulator for Atmel's AVR core.
   Copyright (C) 2009-2020 Free Software Foundation, Inc.
   Written by Tristan Gingold, AdaCore.

   This file is part of GDB, the GNU debugger.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks like GDB has a bug where it "confuses" instruction memory with SRAM for the AVR.  A bug report was logged in 2010 for it. 

 

https://sourceware.org/bugzilla/...

 

I'm guessing that is the reason Eclipse is having an issue.  When I turn on GDB traces, it shows that the debugger is returning disassembled code but it's pulling from SRAM instead of instruction memory.

 

448,584 (gdb)
927,859 43-data-disassemble --thread 1 -s 164 -e 280 -- 2
927,868 43^done,asm_insns=[{address="0x008000a4",opcodes="00 00",inst="nop"},{address="0x008000a6",o\
pcodes="00 00",inst="nop"},{address="0x008000a8",opcodes="00 00",inst="nop"},{address="0x008000aa",o\
pcodes="00 00",inst="nop"},{address="0x008000ac",opcodes="00 00",inst="nop"},{address="0x008000ae",o\
pcodes="00 00",inst="nop"},{address="0x008000b0",opcodes="00 00",inst="nop"},{address="0x008000b2",o\
pcodes="00 00",inst="nop"},{address="0x008000b4",opcodes="00 00",inst="nop"},{address="0x008000b6",o\
[message truncated to 5 lines. More lines can be set in the Preference->Debug->GDB eclipse preference page.]