Improve handle_profile_command argument parsing:
- Use parse_uint to ensure timeout value parses properly. git-svn-id: svn://svn.berlios.de/openocd/trunk@2238 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
b7c5e630ea
commit
af52480a45
|
@ -2823,12 +2823,12 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
|
||||||
{
|
{
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
char *end;
|
unsigned offset;
|
||||||
timeval_add_time(&timeout, strtoul(args[0], &end, 0), 0);
|
int retval = parse_uint(args[0], &offset);
|
||||||
if (*end)
|
if (ERROR_OK != retval)
|
||||||
{
|
return retval;
|
||||||
return ERROR_OK;
|
|
||||||
}
|
timeval_add_time(&timeout, offset, 0);
|
||||||
|
|
||||||
command_print(cmd_ctx, "Starting profiling. Halting and resuming the target as often as we can...");
|
command_print(cmd_ctx, "Starting profiling. Halting and resuming the target as often as we can...");
|
||||||
|
|
||||||
|
@ -2838,7 +2838,6 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
int numSamples=0;
|
int numSamples=0;
|
||||||
int retval=ERROR_OK;
|
|
||||||
/* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */
|
/* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */
|
||||||
reg_t *reg = register_get_by_name(target->reg_cache, "pc", 1);
|
reg_t *reg = register_get_by_name(target->reg_cache, "pc", 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue