summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-13 00:34:24 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-13 00:34:24 +0000
commitaf52480a4509d6b76766db521e2fd4d9bbfe0a82 (patch)
treea59745430920d2f2bf3c2ac999256e989add1393 /src
parentb7c5e630ea9a7b1a5212c0a584cfe8e4252a6cf1 (diff)
downloadopenocd_libswd-af52480a4509d6b76766db521e2fd4d9bbfe0a82.tar.gz
openocd_libswd-af52480a4509d6b76766db521e2fd4d9bbfe0a82.tar.bz2
openocd_libswd-af52480a4509d6b76766db521e2fd4d9bbfe0a82.tar.xz
openocd_libswd-af52480a4509d6b76766db521e2fd4d9bbfe0a82.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 20e82319..e269a536 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2823,12 +2823,12 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
{
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...");
@@ -2838,7 +2838,6 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
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);