Hi there,
i am utilizing OpenOCD as a library for a fault injection project on a Pandaboard ES.
I need to
For the navigational task, i am using breakpoints (later also watchpoints), to find the specific point in time, where i will inject a fault.
A simple scenario is as follows:
The trace consists of only one repeated instruction A and i need to get to the 100th execution of A. So i use a breakpoint and count up everytime it hits.
The code looks like this:
// Find target
struct target *target;
target = get_target("omap4460.cpu");
if (!target) {
LOG_USER("Target not found!\n");
return 1;
}
// Reset target
if (reset(cmd_ctx, RESET_RUN)) { // copy of static int target_process_reset(struct command_context *cmd_ctx, enum target_reset_mode reset_mode) [target.c]
LOG_USER("Error while resetting target");
return 1;
}
if (target_halt(target)) {
LOG_USER("Target could not be haltet\n");
return 1;
}
if (target_poll(target)) {
LOG_USER("Error polling after halt!\n");
return 1;
}
if (breakpoint_add(target, 2197816436, 4, BKPT_HARD)) {
LOG_USER("Breakpoint not set!\n");
return 1;
}
int i;
for (i = 0; i < 100; i++) {
if (target_resume(target, 1, 0, 1, 0)) {
LOG_USER("Target could not be resumed!\n");
return 1;
}
// wait for breakpoint
while (1) {
if (target_poll(target)) {
LOG_USER("Error polling after resume!\n");
return 1;
}
if (target->debug_reason == DBG_REASON_BREAKPOINT) {
break;
}
}
if (target_step(target, 1, 0, 1)) {
LOG_USER("Stepping error!\n");
return 1;
}
}
I have two problems with this code.
First of all: I can’t do it without the target_step, because parameter 4 (handle_breakpoints) of target_resume seems not to work for Pandaboard. If i don’t make a step, it doesn’t continue after resume, but ends up in the breakpoint again.
Also this is very slow. I measured the time for one stop-and-go-execution and it is 246ms.
After investigating the execution with callgrind, i saw, most of the time is spent in target_step.
Is there any way to get the resume working on Pandaboard? Am i doing something wrong fundamentally?
Thank you in advance
Lars