Using catch command in JimTcl to get command return status

Open source ARM Debugger

Moderator: phalanx

Post Reply
harish kumar
Posts: 3
Joined: Tue Nov 18, 2014 3:29 am

Using catch command in JimTcl to get command return status

Post by harish kumar » Mon Dec 01, 2014 4:57 am

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

Post Reply