From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27682 invoked by alias); 21 Jan 2010 22:41:46 -0000 Received: (qmail 27666 invoked by uid 22791); 21 Jan 2010 22:41:44 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from nwd2mail11.analog.com (HELO nwd2mail11.analog.com) (137.71.25.57) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jan 2010 22:41:36 +0000 Received: from nwd2hubcas2.ad.analog.com ([10.64.73.30]) by nwd2mail11.analog.com with ESMTP; 21 Jan 2010 17:41:34 -0500 Received: from nwd2exm5.ad.analog.com (10.64.51.20) by NWD2HUBCAS2.ad.analog.com (10.64.73.30) with Microsoft SMTP Server id 8.1.358.0; Thu, 21 Jan 2010 17:41:34 -0500 Received: from chinexm1.ad.analog.com ([10.99.27.42]) by nwd2exm5.ad.analog.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 21 Jan 2010 17:41:34 -0500 Received: from [192.168.5.133] ([10.99.29.111]) by chinexm1.ad.analog.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 22 Jan 2010 06:41:29 +0800 Message-ID: <4B58D811.8070604@analog.com> Date: Thu, 21 Jan 2010 22:41:00 -0000 From: Jie Zhang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100121 Lightning/1.0b1 Shredder/3.0.1 MIME-Version: 1.0 To: Michael Snyder , Dave Korn , "gdb@sourceware.org" Subject: Re: Reset breakpoint after load? References: <4B5560E0.3080901@analog.com> <4B582A02.2040501@gmail.com> <4B589CF2.2040304@vmware.com> <20100121211950.GA11880@caradoc.them.org> In-Reply-To: <20100121211950.GA11880@caradoc.them.org> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00177.txt.bz2 On 01/22/2010 05:19 AM, Daniel Jacobowitz wrote: > 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 didn't notice this issue until recently a bug in toolchain linked in simulator libc for bare metal executable, which made this issue easily happen. >> 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. > Yeah, it's a little strange. Jie