Daniel, the issue is caused by the code in aarch64_step() that at the end does not check the status of the core and does not call the event TARGET_EVENT_HALTED. You can compare the code with the one in cortex_m.c and cortex_a.c. cortex_a_step() directly calls cortex_a_poll().
The former incorrect implementation was running a polling of all targets after each TCL command. This causes huge performance degradation and does not comply with the design of having a time-based polling. --- **[tickets:#397] OpenOCD TCL script execution failure with commit 95603fae1** **Status:** new **Milestone:** 0.11.0 **Created:** Sat May 27, 2023 01:28 AM UTC by Daniel Goehring **Last Updated:** Sat May 27, 2023 01:28 AM UTC **Owner:** nobody Hello, The following commit which is post "openocd-0.12.0 release" has introduced stability issues in my AArch64 TCL scripting environment and I'm wondering if others have experienced similar issues. 95603fae1 openocd: revert workarounds for 'expr' syntax change With this update, while the TCL script runs faster due to the reduction in polling during math expressions, it does cause script execution instability. For example, the following TCL scripted sequence previously worked, but now fails with the update. // The target being stepped is an Armv8 core in AArch64 state 1. step 2. reg x0 With the update, it appears in the TCL script the "reg x0" operation occurs before the poller has a chance to determine the CPU has halted from the 'step' command. OpenOCD then halts the script execution and returns with an error stating that it's unable to read register x0 because the CPU core isn't halted. As a workaround, adding a 'sleep' delay between the 'step' and 'reg x0' command resolves the issue, but it is not ideal. With this update, it appears that in a TCL script, any command that causes a processor state change from 'running' to 'halted' followed by a command which requires the processor to be halted could fail if the poller hasn't updated processor state between the two commands. I don't have the background details on this commit (95603fae1), but wanted to bring it to the attention of the development community. Daniel Goehring --- Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is subscribed to https://sourceforge.net/p/openocd/tickets/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.