]> www.infradead.org Git - users/borneoa/openocd-next.git/commit
cortex-a: fix single-step on infinite loop
authorAntonio Borneo <borneo.antonio@gmail.com>
Fri, 2 May 2025 14:10:39 +0000 (16:10 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 25 May 2025 12:40:05 +0000 (12:40 +0000)
commit532db01df29ab0636911f5cb0b40ed5747879c4e
tree34e9c7e349d6761bba7c6e8555104a3b283eee80
parent6a3abda0b46a777490a8ce5bc748e6fed6775354
cortex-a: fix single-step on infinite loop

On ARMv7a/r the single-step is implemented through a HW breakpoint
that hits instructions at any address except the address of the
current instruction.

The method above fails in case of an infinite loop coded by a
single instruction that jumps on itself; in such case, the same
instruction (at the same address) is executed over and over and
the breakpoint never hits. In current code this case is wrongly
considered as an error.

Reduce the timeout while waiting for the HW breakpoint being hit,
then halt.

The jump on itself would be executed several times before the
timeout and the halt, but this is not an issue. There are few
"pathological" instructions in ARMv7a/r that jumps on itself and
that can have side effects if executed more than once. They are
listed in the code. We do not consider these as real use cases
generated by a compiler.

Document the method in the code.

Report that the single-step function is not properly managing the
HW breakpoints if it exits on error. To be fixed in the future.

Change-Id: I9641a4a3e2f68b83897ccf3a12d3c34e98a7805c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8871
Tested-by: jenkins
src/target/cortex_a.c