Commit d0a300e0 authored by zwelch's avatar zwelch
Browse files

Improve and simplify handle_bp_command and handle_rbp_command:

- Bug fix: return syntax error if remove called without one argument.
- Use parse_u32 to ensure address and length arguments parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2235 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 16c77cf3
......@@ -2541,8 +2541,15 @@ static int handle_bp_command(struct command_context_s *cmd_ctx,
return ERROR_COMMAND_SYNTAX_ERROR;
}
u32 addr = strtoul(args[0], NULL, 0);
u32 length = strtoul(args[1], NULL, 0);
u32 addr;
int retval = parse_u32(args[0], &addr);
if (ERROR_OK != retval)
return retval;
u32 length;
retval = parse_u32(args[1], &length);
if (ERROR_OK != retval)
return retval;
int hw = BKPT_SOFT;
if (argc == 3)
......@@ -2558,10 +2565,16 @@ static int handle_bp_command(struct command_context_s *cmd_ctx,
static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target = get_current_target(cmd_ctx);
if (argc != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
if (argc > 0)
breakpoint_remove(target, strtoul(args[0], NULL, 0));
u32 addr;
int retval = parse_u32(args[0], &addr);
if (ERROR_OK != retval)
return retval;
target_t *target = get_current_target(cmd_ctx);
breakpoint_remove(target, addr);
return ERROR_OK;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment