fixed a few crashes in syntax handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1060 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
2de5a007d1
commit
c40d652546
|
@ -1236,8 +1236,7 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
|
||||
if (argc != 5)
|
||||
{
|
||||
LOG_ERROR("incomplete 'etm config <target> <port_width> <port_mode> <clocking> <capture_driver>' command");
|
||||
exit(-1);
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
target = get_target_by_num(strtoul(args[0], NULL, 0));
|
||||
|
@ -1245,13 +1244,13 @@ int handle_etm_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;
|
||||
}
|
||||
|
||||
switch (strtoul(args[1], NULL, 0))
|
||||
|
@ -1267,7 +1266,7 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
break;
|
||||
default:
|
||||
command_print(cmd_ctx, "unsupported ETM port width '%s', must be 4, 8 or 16", args[1]);
|
||||
return ERROR_OK;
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
if (strcmp("normal", args[2]) == 0)
|
||||
|
@ -1285,7 +1284,7 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
else
|
||||
{
|
||||
command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", args[2]);
|
||||
return ERROR_OK;
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
if (strcmp("half", args[3]) == 0)
|
||||
|
@ -1299,17 +1298,18 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
else
|
||||
{
|
||||
command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", args[3]);
|
||||
return ERROR_OK;
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
for (i=0; etm_capture_drivers[i]; i++)
|
||||
{
|
||||
if (strcmp(args[4], etm_capture_drivers[i]->name) == 0)
|
||||
{
|
||||
if (etm_capture_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
|
||||
int retval;
|
||||
if ((retval=etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK)
|
||||
{
|
||||
free(etm_ctx);
|
||||
exit(-1);
|
||||
return retval;
|
||||
}
|
||||
|
||||
etm_ctx->capture_driver = etm_capture_drivers[i];
|
||||
|
@ -1323,7 +1323,7 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
/* no supported capture driver found, don't register an ETM */
|
||||
free(etm_ctx);
|
||||
LOG_ERROR("trace capture driver '%s' not found", args[4]);
|
||||
return ERROR_OK;
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
etm_ctx->target = target;
|
||||
|
@ -1347,9 +1347,7 @@ int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
|
||||
arm7_9->etm_ctx = etm_ctx;
|
||||
|
||||
etm_register_user_commands(cmd_ctx);
|
||||
|
||||
return ERROR_OK;
|
||||
return etm_register_user_commands(cmd_ctx);
|
||||
}
|
||||
|
||||
int handle_etm_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||
|
@ -1852,7 +1850,7 @@ int etm_register_commands(struct command_context_s *cmd_ctx)
|
|||
{
|
||||
etm_cmd = register_command(cmd_ctx, NULL, "etm", NULL, COMMAND_ANY, "Embedded Trace Macrocell");
|
||||
|
||||
register_command(cmd_ctx, etm_cmd, "config", handle_etm_config_command, COMMAND_CONFIG, NULL);
|
||||
register_command(cmd_ctx, etm_cmd, "config", handle_etm_config_command, COMMAND_CONFIG, "etm config <target> <port_width> <port_mode> <clocking> <capture_driver>");
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue