error checking - no reported errors, but catched a couple of exit()'s and converted them to errors.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1175 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2008-11-19 07:32:30 +00:00
parent 6c15861bd8
commit cb434c21af
5 changed files with 186 additions and 178 deletions

View File

@ -180,7 +180,7 @@ int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, c
if (info->target == NULL)
{
LOG_ERROR("no target '%i' configured", (int)strtoul(args[5], NULL, 0));
exit(-1);
return ERROR_FAIL;
}
return ERROR_OK;
}

View File

@ -419,8 +419,7 @@ int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char
if (argc != 2)
{
LOG_ERROR("incomplete 'etb config <target> <chain_pos>' command");
exit(-1);
return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_target_by_num(strtoul(args[0], NULL, 0));
@ -428,13 +427,13 @@ int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char
if (!target)
{
LOG_ERROR("target number '%s' not defined", args[0]);
exit(-1);
return ERROR_FAIL;
}
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
{
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
return ERROR_OK;
return ERROR_FAIL;
}
jtag_device = jtag_get_device(strtoul(args[1], NULL, 0));
@ -442,7 +441,7 @@ int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char
if (!jtag_device)
{
LOG_ERROR("jtag device number '%s' not defined", args[1]);
exit(-1);
return ERROR_FAIL;
}
if (arm7_9->etm_ctx)
@ -460,6 +459,7 @@ int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char
else
{
LOG_ERROR("target has no ETM defined, ETB left unconfigured");
return ERROR_FAIL;
}
return ERROR_OK;

View File

@ -47,13 +47,13 @@ int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd
if (!target)
{
LOG_ERROR("target number '%s' not defined", args[0]);
exit(-1);
return ERROR_FAIL;
}
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
{
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
return ERROR_OK;
return ERROR_FAIL;
}
if (arm7_9->etm_ctx)
@ -63,6 +63,7 @@ int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd
else
{
LOG_ERROR("target has no ETM defined, ETM dummy left unconfigured");
return ERROR_FAIL;
}
return ERROR_OK;

View File

@ -718,6 +718,13 @@ int image_open(image_t *image, char *url, char *type_string)
}
else if (image->type == IMAGE_MEMORY)
{
target_t *target = get_target_by_num(strtoul(url, NULL, 0));
if (target==NULL)
{
LOG_ERROR("Target '%s' does not exist", url);
return ERROR_FAIL;
}
image_memory_t *image_memory;
image->num_sections = 1;
@ -728,7 +735,7 @@ int image_open(image_t *image, char *url, char *type_string)
image_memory = image->type_private = malloc(sizeof(image_memory_t));
image_memory->target = get_target_by_num(strtoul(url, NULL, 0));;
image_memory->target = target;
image_memory->cache = NULL;
image_memory->cache_address = 0x0;
}

View File

@ -3179,12 +3179,12 @@ int xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, char
if ((target = get_target_by_num(strtoul(args[0], NULL, 0))) == NULL)
{
LOG_ERROR("no target '%s' configured", args[0]);
return ERROR_OK;
return ERROR_FAIL;
}
if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK)
{
return ERROR_OK;
return ERROR_FAIL;
}
handler_address = strtoul(args[1], NULL, 0);
@ -3197,6 +3197,7 @@ int xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, char
else
{
LOG_ERROR("xscale debug_handler <address> must be between 0x800 and 0x1fef800 or between 0xfe000800 and 0xfffff800");
return ERROR_FAIL;
}
return ERROR_OK;
@ -3212,19 +3213,18 @@ int xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx,
if (argc < 2)
{
LOG_ERROR("'xscale cache_clean_address <target#> <address>' command takes two required operands");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target_by_num(strtoul(args[0], NULL, 0))) == NULL)
{
LOG_ERROR("no target '%s' configured", args[0]);
return ERROR_OK;
return ERROR_FAIL;
}
if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK)
{
return ERROR_OK;
return ERROR_FAIL;
}
cache_clean_address = strtoul(args[1], NULL, 0);