From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29959 invoked by alias); 12 Apr 2003 19:54:57 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 29951 invoked from network); 12 Apr 2003 19:54:57 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 12 Apr 2003 19:54:57 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h3CJsuD05988 for ; Sat, 12 Apr 2003 15:54:56 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h3CJstW30510; Sat, 12 Apr 2003 15:54:55 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h3CJssS31415; Sat, 12 Apr 2003 12:54:55 -0700 Message-ID: <3E986F0E.883BE2F@redhat.com> Date: Sat, 12 Apr 2003 19:54:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Jafa CC: gdb@sources.redhat.com Subject: Re: self decompressing code References: <043701c3004a$49ca4b00$f601a8c0@scenix.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00122.txt.bz2 Jafa wrote: > > Hi all, > > This isn't a problem with GDB but I would appreciate your advice on a usage > model.... > > The ip2k is an embedded processor and we compile a single elf file to be > used to program and debug the ip2k which executes out of internal flash. > > External flash can also be used and I have just added code to remote-ip2k.c > to program external flash. > > The image that is uploaded to external flash is a compressed upgrade image. > When the chip boots up it will decompress code/data to internal flash and > external flash. > > This scheme works well except for two problems: > 1) GDB downloads the .text section even though it is not needed and is > overwritten. If I change the section flags such that the .text section is > not loadable then GDB complains that it can't debug the file. What's in the text section that isn't needed? Can you just create a dummy text section that is small, so that it won't take long to DL and can be ignored? > 2) Any breakpoints that are inserted are overwritten - I need to add a break > on the reset vector. I don't understand -- why would any breakpoints be inserted at the time when you're doing a download? GDB only inserts breakpoints when the program being debugged is running. > Ideas so far: > 1) Modify the upgrade/decompression code so that it doesn't write the > internal flash. This would solve the breakpoint problem but is noticably > slower (it is faster to upload the compressed image) and the scheme will be > difficult to modify. > 2) Modify gdb so it ignores the fact that the .text section isn't loadable. > Add an auto-inserted breakpoint on the reset vector. > > If you have any thoughts or ideas I would appreciate the advice. Why can't you just set a normal gdb breakpoint on the reset vector?