This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703)
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: Terry Guo <Terry dot Guo at arm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "pedro at codesourcery dot com" <pedro at codesourcery dot com>
- Date: Fri, 01 Jul 2011 09:59:07 +0100
- 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>
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 which 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.......
>> .........
>>
>
> 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
>
> main:
> b test
>
> bar:
> push ...
>
> test:
> moves r5, #10
>
> After test, processor will run some instructions that we don't know.
> IMO, it is incorrect.
>
Which is one of the reasons why GCC has the option -fno-toplevel-reorder
to prevent such reordering.
R.