From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2928 invoked by alias); 21 Jan 2010 21:20:13 -0000 Received: (qmail 2917 invoked by uid 22791); 21 Jan 2010 21:20:12 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jan 2010 21:20:06 +0000 Received: (qmail 15011 invoked from network); 21 Jan 2010 21:20:04 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Jan 2010 21:20:04 -0000 Date: Thu, 21 Jan 2010 21:20:00 -0000 From: Daniel Jacobowitz To: Michael Snyder Cc: Dave Korn , Jie Zhang , "gdb@sourceware.org" Subject: Re: Reset breakpoint after load? Message-ID: <20100121211950.GA11880@caradoc.them.org> Mail-Followup-To: Michael Snyder , Dave Korn , Jie Zhang , "gdb@sourceware.org" References: <4B5560E0.3080901@analog.com> <4B582A02.2040501@gmail.com> <4B589CF2.2040304@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B589CF2.2040304@vmware.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00174.txt.bz2 On Thu, Jan 21, 2010 at 10:29:06AM -0800, Michael Snyder wrote: > >On 19/01/2010 07:36, Jie Zhang wrote: > > > >>gdb-comm.exp sets breakpoints on exit and abort before load. The problem > >>is that GDB tries to skip prologue according to what it reads from > >>memory, which might contain random data since the executable has not > >>been loaded into memory. In my case, sometimes skip_prologue might skip > >>one or two more instructions, which happens to be an exception > >>instruction and will trap the processor into an exception event loop > >>after running the executable before hit the breakpoints. I've had this problem on a MIPS target, too. > I don't believe that gdb can tell when the (remote) inferior > is started. All gdb knows is that target remote is started. > Thus, if we connect to target remote and then load the image, > there is an interval during which gdb will attempt to read > the prologue bytes from un-initialized target memory. > > Seems to me, that interval is a bad time to set breakpoints. The problem isn't just breakpoints set during the interval, but also before target remote. We adjust the breakpoints after target remote. GDB doesn't know whether we're going to need to load. Maybe it should be an option to target remote to load automatically? I don't know, that's a little strange. -- Daniel Jacobowitz CodeSourcery