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: "Terry Guo" <terry dot guo at arm dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: <yao at codesourcery dot com>, <pedro at codesourcery dot com>
- Date: Wed, 29 Jun 2011 09:26:17 +0800
- Subject: RE: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703)
- References: <000901cc34bc$fd1aa6a0$f74ff3e0$@guo@arm.com>
Hi,
I slightly modified the test case and got the below code:
00008142 <test>:
8142: 250a movs r5, #10
00008144 <bar>:
8144: b510 push {r4, lr}
8146: 2300 movs r3, #0
8148: 4c07 ldr r4, [pc, #28] ; (8168 <bar+0x24>)
814a: 4908 ldr r1, [pc, #32] ; (816c <bar+0x28>)
814c: 4808 ldr r0, [pc, #32] ; (8170 <bar+0x2c>)
814e: e001 b.n 8154 <bar+0x10>
8150: 505a str r2, [r3, r1]
8152: 3304 adds r3, #4
8154: 185a adds r2, r3, r1
8156: 4282 cmp r2, r0
8158: 591a ldr r2, [r3, r4]
815a: d3f9 bcc.n 8150 <bar+0xc>
815c: 42aa cmp r2, r5
815e: bf8c ite hi
8160: 2500 movhi r5, #0
8162: 2501 movls r5, #1
8164: bd10 pop {r4, pc}
8166: bf00 nop
Without Yao's patch, the "b bar" sets the break point at 0x8158. With Yao's
patch, the "b test" still sets the break point at 0x814e that is outside the
function test body. But the "b bar" sets the break point at 0x814e which is
better than 0x8158. IMHO, theoretically function test could have many other
different kinds of instruction patterns. So I think it is better to have two
enhancements one is Yao's patch which enhances the function
thumb_analyze_prologue and make it more accurate, and another one is my
patch which ensures the function break point to be always set inside the
function body in a more general way. Does this solution sound good?
Best regards,
Terry