From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2506 invoked by alias); 1 Jul 2011 08:59:27 -0000 Received: (qmail 2497 invoked by uid 22791); 1 Jul 2011 08:59:26 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (94.185.240.25) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Fri, 01 Jul 2011 08:59:13 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 01 Jul 2011 09:59:09 +0100 Received: from [10.1.67.34] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 1 Jul 2011 09:59:08 +0100 Message-ID: <4E0D8C5B.2090407@arm.com> Date: Fri, 01 Jul 2011 08:59:00 -0000 From: Richard Earnshaw User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-GB; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: Yao Qi CC: Terry Guo , "gdb-patches@sourceware.org" , "pedro@codesourcery.com" Subject: Re: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703) References: <000901cc34bc$fd1aa6a0$f74ff3e0$@guo@arm.com> <000101cc35fb$8d45ff60$a7d1fe20$@guo@arm.com> <4E0AB9B3.8060104@codesourcery.com> <000501cc362a$2e7f9020$8b7eb060$@guo@arm.com> <4E0ADB87.20807@codesourcery.com> <45520D6299C11E4588128526465332BB0D0C8B1246@SAROVARA.Asiapac.Arm.com> <4E0AF7A6.1040800@codesourcery.com> In-Reply-To: <4E0AF7A6.1040800@codesourcery.com> X-MC-Unique: 111070109590905001 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00004.txt.bz2 On 29/06/11 11:00, Yao Qi wrote: > On 06/29/2011 04:47 PM, Terry Guo wrote: >> Hi, >> >> First if you look at the generated binary code, I thought it is a valid = case. After performing the function test, it will fall into function bar wh= ich is a normal function. At least my case can run correctly on QEMU. It is= very likely for people to write program in assembly code like: >> >> main: >> b test >> >> test: >> movs r5, #10 >> bar: >> push....... >> ......... >> >=20 > We are lucky here GCC places bar next to function test physically, but > gcc may also place function test and bar in other layout, like >=20 > main: > b test >=20 > bar: > push ... >=20 > test: > moves r5, #10 >=20 > After test, processor will run some instructions that we don't know. > IMO, it is incorrect. >=20 Which is one of the reasons why GCC has the option -fno-toplevel-reorder to prevent such reordering. R.