RE: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703)

Terry Guo
2011-06-29T01:26:54Z

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