|
From: <zw...@ma...> - 2009-06-13 02:34:58
|
Author: zwelch
Date: 2009-06-13 02:34:24 +0200 (Sat, 13 Jun 2009)
New Revision: 2238
Modified:
trunk/src/target/target.c
Log:
Improve handle_profile_command argument parsing:
- Use parse_uint to ensure timeout value parses properly.
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2009-06-13 00:34:17 UTC (rev 2237)
+++ trunk/src/target/target.c 2009-06-13 00:34:24 UTC (rev 2238)
@@ -2823,13 +2823,13 @@
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
- char *end;
- timeval_add_time(&timeout, strtoul(args[0], &end, 0), 0);
- if (*end)
- {
- return ERROR_OK;
- }
+ unsigned offset;
+ int retval = parse_uint(args[0], &offset);
+ if (ERROR_OK != retval)
+ return retval;
+ timeval_add_time(&timeout, offset, 0);
+
command_print(cmd_ctx, "Starting profiling. Halting and resuming the target as often as we can...");
static const int maxSample=10000;
@@ -2838,7 +2838,6 @@
return ERROR_OK;
int numSamples=0;
- int retval=ERROR_OK;
/* 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);
|