This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 <bar>:
    8146:       b510            push    {r4, lr}
    8148:       2200            movs    r2, #0
    814a:       4905            ldr     r1, [pc, #20]   ; (8160 <bar+0x1a>)
    814c:       4c05            ldr     r4, [pc, #20]   ; (8164 <bar+0x1e>)
    814e:       4806            ldr     r0, [pc, #24]   ; (8168 <bar+0x22>)
    8150:       e002            b.n     8158 <bar+0x12>
    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 <bar+0xc>
    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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]