From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21115 invoked by alias); 21 Jan 2010 22:35:55 -0000 Received: (qmail 21107 invoked by uid 22791); 21 Jan 2010 22:35:54 -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:35:47 +0000 Received: from nwd2hubcas2.ad.analog.com ([10.64.73.30]) by nwd2mail11.analog.com with ESMTP; 21 Jan 2010 17:35:45 -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:35:45 -0500 Received: from nwd2exm20.ad.analog.com ([10.64.73.20]) by nwd2exm5.ad.analog.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 21 Jan 2010 17:35:45 -0500 Received: from chinexm1.ad.analog.com ([10.99.27.42]) by nwd2exm20.ad.analog.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 21 Jan 2010 17:35:44 -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:35:39 +0800 Message-ID: <4B58D6B3.9030701@analog.com> Date: Thu, 21 Jan 2010 22:35: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 CC: Dave Korn , "gdb@sourceware.org" Subject: Re: Reset breakpoint after load? References: <4B5560E0.3080901@analog.com> <4B582A02.2040501@gmail.com> <4B589CF2.2040304@vmware.com> In-Reply-To: <4B589CF2.2040304@vmware.com> 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/msg00176.txt.bz2 On 01/22/2010 02:29 AM, Michael Snyder wrote: > Dave Korn 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. >> >> Something is wrong here. Before the inferior is started, gdb should be >> looking at the prologue bytes from the executable image file, not the >> inferior >> memory. Is something going wrong in gdb_comm_file_cmd()? > > Dave, Jie, > > 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. > I agree that that interval is a bad time to set breakpoints. But if GDB re-set breakpoints after load, it still can get the breakpoint set at the right addresses. Jie