SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By harish kumar
#177301
Dear All,

I would like to know, how to get the return status of command executed in openocd.
After exploring a while, i figured out "catch" command.

But, there is inconsistency, because, there are commands, on error case, they return ERROR_OK.
for example,
COMMAND_HANDLER(handle_flash_erase_command)
{
retval = flash_driver_erase(p, first, last);

if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
command_print(CMD_CTX, "erased sectors %" PRIu32 " "
"through %" PRIu32 " on flash bank %d "
"in %fs", first, last, p->bank_number, duration_elapsed(&bench));
}

return ERROR_OK; -- this should be "return retval".
}

Any thoughts, how to retrieve return status for commands and validate failure??

Thanks and Regards,
Harish Kumar V