From: Mike Dunn <miked...@newsguy.com> Problem: halt at a breakpoint, enable trace buffer ('xscale trace_buffer enable fill'), then resume. Wait for debug exception when trace buffer fills (if not sooner due to another breakpoint, vector catch, etc). Instead, never halts. When halted explicitly from OpenOCD and trace buffer dumped, it contains only one entry; a branch to the address of the original breakpoint. If the above steps are repeated, except that the breakpoint is removed before resuming, the trace buffer fills and the debug exception is generated, as expected.
Cause: related to how a breakpoint is stepped over on resume. The breakpoint is temporarily removed, and a hardware breakpoint is set on the next instruction that will execute. xscale_debug_entry() is called when that breakpoint hits. This function checks if the trace buffer is enabled, and if so reads the trace buffer from the target and then disables the trace (unless multiple trace buffers are specified by the user when trace is enabled). Thus you only trace one instruction before it is disabled. Solution: kind of a hack on top of a hack, but it's simple. Anything better would involve some refactoring. This has been tested and trace now works as intended, except that the very first instruction is not part of the trace when resuming from a breakpoint. --- src/target/xscale.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/target/xscale.c b/src/target/xscale.c index e578a77..ef3ec32 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1206,6 +1206,7 @@ static int xscale_resume(struct target *target, int current, if (breakpoint != NULL) { uint32_t next_pc; + int saved_trace_buffer_enabled; /* there's a breakpoint at the current PC, we have to step over it */ LOG_DEBUG("unset breakpoint at 0x%8.8" PRIx32 "", breakpoint->address); @@ -1254,9 +1255,15 @@ static int xscale_resume(struct target *target, int current, LOG_DEBUG("writing PC with value 0x%8.8" PRIx32, buf_get_u32(armv4_5->pc->value, 0, 32)); + /* remember trace buffer state; xscale_debug_entry() will disable */ + saved_trace_buffer_enabled = xscale->trace.buffer_enabled; + /* wait for and process debug entry */ xscale_debug_entry(target); + /* restore trace buffer state */ + xscale->trace.buffer_enabled = saved_trace_buffer_enabled; + LOG_DEBUG("disable single-step"); xscale_disable_single_step(target); -- 1.6.4.4 _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development