This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data watch exception doesn't work(uninvasive debug)

Hello,

I'm trying to use uninvasive debug module in cortex-a53, and I tried to do test by using data watch event. My process as follows:

1. Set MDSCR_EL1.KDE to enable debug exception in El1;

2. Enable debug exception by escuting MSR DAIFclr, #8, and make sure debug exception can be triggered, MSR DAIFclr, #1 also be excuted;

3. Set MDSCR_EL1.MDE to enable breakpoint and watchpoint;

4. Configure DBGWVR0_EL1 and DBGWCR0_EL1, and make sure instruction store (LSC == 0b10) to the address in DBGWVR0_EL1 will happen.

5. sync exception function also already configured in Exception Vector;

When I run my test software by connecting Lauterbach(trace32), I can see sw can stop when instruction store to target address in DBGWVR0_EL1, and address in DLR_EL0 is the exception function address. But when Lauterbach removed and rerun test software, the exception function configured in exception vector not excuted.

Any one can help me to find out why this datawatch exception not work?

Thank you!

Parents
  • Hi, DataWatch exception not triggered reason I foud, seems I have to unlock os lock at first, this os unlock is the key to go to debug mode, maybe. Now I got the other reason, seems I fail to handle context save and restore in exception handler, I step and ldp x0~x30, elr_el1 and spsr_el1, use eret to excit exception. And I try to strore #1 to target address, but when DataWatch exception handler done, the target address value not turn to #1, so I think, something wrong with exception handler, anyone can please give a hint why? Or some reference doucument of exception handler. 

    -------------------------------------------------------------------------------------------------------------

    As to step exception not work, I fix it by clearing SPSR_EL1.d = 0 and setting SPSR.EL1.ss = 1 in the exception handler.

    Note: ARM debug exceptins (:Datawatch, breakpoint and software step), they are all synschronous exceptions, so just like the reference of this ticket described (https://community.arm.com/support-forums/f/architectures-and-processors-forum/6524/about-watch-point-debug-excption-on-cortex-a53/20827#20827), when return from exception, it will re-excute the instruction again, so we have to disable it in the exception handler. --- so the issue desriced in the suggested ticket wesite is right.

    In conclusion: ARM debug exception is limited to do debug analysis of some keep-changing instructions, it's not easy to develop a common un-invasive interfaces in the product, because sometimes we have do design debug fucntions according to the specifc condtion.

Reply
  • Hi, DataWatch exception not triggered reason I foud, seems I have to unlock os lock at first, this os unlock is the key to go to debug mode, maybe. Now I got the other reason, seems I fail to handle context save and restore in exception handler, I step and ldp x0~x30, elr_el1 and spsr_el1, use eret to excit exception. And I try to strore #1 to target address, but when DataWatch exception handler done, the target address value not turn to #1, so I think, something wrong with exception handler, anyone can please give a hint why? Or some reference doucument of exception handler. 

    -------------------------------------------------------------------------------------------------------------

    As to step exception not work, I fix it by clearing SPSR_EL1.d = 0 and setting SPSR.EL1.ss = 1 in the exception handler.

    Note: ARM debug exceptins (:Datawatch, breakpoint and software step), they are all synschronous exceptions, so just like the reference of this ticket described (https://community.arm.com/support-forums/f/architectures-and-processors-forum/6524/about-watch-point-debug-excption-on-cortex-a53/20827#20827), when return from exception, it will re-excute the instruction again, so we have to disable it in the exception handler. --- so the issue desriced in the suggested ticket wesite is right.

    In conclusion: ARM debug exception is limited to do debug analysis of some keep-changing instructions, it's not easy to develop a common un-invasive interfaces in the product, because sometimes we have do design debug fucntions according to the specifc condtion.

Children