From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11247 invoked by alias); 21 Jan 2010 12:52:16 -0000 Received: (qmail 11228 invoked by uid 22791); 21 Jan 2010 12:52:15 -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 12:52:09 +0000 Received: from nwd2hubcas2.ad.analog.com ([10.64.73.30]) by nwd2mail11.analog.com with ESMTP; 21 Jan 2010 07:52:08 -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 07:52:07 -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 07:52:07 -0500 Received: from [192.168.2.125] ([10.99.29.111]) by chinexm1.ad.analog.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 21 Jan 2010 20:52:01 +0800 Message-ID: <4B584DDF.2060501@analog.com> Date: Thu, 21 Jan 2010 12:52:00 -0000 From: Jie Zhang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20100114 Lightning/1.0b1 Shredder/3.0 MIME-Version: 1.0 To: Dave Korn CC: gdb@sourceware.org Subject: Re: Reset breakpoint after load? References: <4B5560E0.3080901@analog.com> <4B582A02.2040501@gmail.com> In-Reply-To: <4B582A02.2040501@gmail.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/msg00172.txt.bz2 On 01/21/2010 06:18 PM, 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()? > Originally gdb_comm_load () did as below: 1. set breakpoints at abort and exit 2. target $protocol $targetname 3. load At 1, gdb reads from executable image file when analyze prologue. At 2, gdb re-set breakpoints according the bytes read from target memory. So after 3 we need to re-set breakpoint again. I have proposed a patch to dejagnu to change the order to 1. target $protocol $targetname 2. load 3. set breakpoints at abort and exit which has been accepted and committed. But I think it's still a good idea to add the breakpoint re-set in GDB after load. Jie