From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30948 invoked by alias); 27 Jun 2011 11:26:25 -0000 Received: (qmail 30917 invoked by uid 22791); 27 Jun 2011 11:26:23 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_50,MSGID_MULTIPLE_AT,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; Mon, 27 Jun 2011 11:26:08 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 27 Jun 2011 12:26:05 +0100 Received: from Terrysh02 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Mon, 27 Jun 2011 12:26:03 +0100 From: "Terry Guo" To: Subject: Re: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703) Date: Mon, 27 Jun 2011 11:26:00 -0000 Message-ID: <000901cc34bc$fd1aa6a0$f74ff3e0$@guo@arm.com> MIME-Version: 1.0 X-MC-Unique: 111062712260501301 Content-Type: text/plain; charset=WINDOWS-1252 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-06/txt/msg00391.txt.bz2 Hi Yao and Pedro, Thanks for your helpful comments. I did learnt a lot from them. After some further investigation, I agree with Yao's patch and think it is better than mine. Yao's patch also fixed another function break point issue which I will show later. I performed "make check" for Yao's patch on QEMU and no regression found. I am reworking the patch according to the comments. I agree with the root cause is the function thumb_instruction_changes_pc fails to catch the b.n instruction. And this is caused by check [1] as pointed by Yao. Here is the disassembly code of function bar: 00008146 : 8146: b510 push {r4, lr} 8148: 2200 movs r2, #0 814a: 4905 ldr r1, [pc, #20] ; (8160 ) 814c: 4c05 ldr r4, [pc, #20] ; (8164 ) 814e: 4806 ldr r0, [pc, #24] ; (8168 ) 8150: e002 b.n 8158 8152: 5813 ldr r3, [r2, r0] 8154: 5053 str r3, [r2, r1] 8156: 3204 adds r2, #4 8158: 1853 adds r3, r2, r1 815a: 42a3 cmp r3, r4 815c: d3f9 bcc.n 8152 815e: bd10 pop {r4, pc} With or without my previous patch, the command "b bar" will set break point at location 0x8158. With Yao's patch, the break point will be set at location 0x8150 because the thumb_instruction_changes_pc catches the b.n instruction. That's also why I think Yao's patch is better. Best regards, Terry