From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21490 invoked by alias); 22 Feb 2006 18:11:53 -0000 Received: (qmail 21477 invoked by uid 22791); 22 Feb 2006 18:11:52 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 22 Feb 2006 18:11:51 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FBySo-0007OF-4f; Wed, 22 Feb 2006 13:11:46 -0500 Date: Wed, 22 Feb 2006 18:23:00 -0000 From: Daniel Jacobowitz To: =?iso-8859-1?Q?Fabr=EDcio?= de Novaes Cc: gdb@sourceware.org Subject: Re: Does GDB use VMA addresses when uploading an image to debug in a remote target? Message-ID: <20060222181146.GA28251@nevyn.them.org> Mail-Followup-To: =?iso-8859-1?Q?Fabr=EDcio?= de Novaes , gdb@sourceware.org References: <1140631963.8331@satelite.dea.inpe.br> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1140631963.8331@satelite.dea.inpe.br> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00296.txt.bz2 On Wed, Feb 22, 2006 at 03:12:43PM -0300, Fabrício de Novaes wrote: > Hi all, > > > I have a GCC application that will run in a board with an ERC32 > (SPARC) processor. For many reasons, this app has to run in RAM, not > ROM. > > So, the ELF32 image has a ".boot" section which starts the board and > copies the main program from a ".text" section to RAM. This .text > section has different LMA (pointing to ROM) and VMA (RAM) addresses, > as you can see below: > > Idx Name Size VMA LMA File off Algn > 0 .boot 00001320 00000000 00000000 000000b4 2**0 > CONTENTS, ALLOC, LOAD, READONLY, CODE > 1 .text 0001d1b0 02001000 00001320 000013d8 2**3 > CONTENTS, ALLOC, LOAD, CODE > [...] > > > I'm trying to debug this app using GDB and a simulator. My problem is > that, when I load the image to debug, the .text section is already in > the 0x2001000 address (VMA), and the LMA area (starting from 0x1320) > is empty - so I can't debug appropriately the routine that copies the > .text section to RAM. > > I'd like to know if GDB loads sections from an ELF file to a target > using the VMA addresses and, if yes, if it's possible to change this > behavior and tell it to send my .text section to its LMA address. GDB does use the VMA, as you've surmised. I'm not sure that what you're suggesting makes sense. How could GDB send the text section to its LMA, if that's a ROM address? The stub will be unable to write to ROM, unless (for example) it is transparently rewriting a flash device or shadowing it with RAM. I recently encountered this problem in another context, where the stub did support reflashing; so maybe GDB needs to be more flexible about it. I'm not sure. -- Daniel Jacobowitz CodeSourcery