Skip to content
Snippets Groups Projects
Commit 3dd5c59d authored by Zachary T Welch's avatar Zachary T Welch
Browse files

Improve armv7a command argument parsing.

parent b62ee5a3
No related branches found
No related tags found
No related merge requests found
...@@ -286,9 +286,16 @@ static int handle_dap_info_command(struct command_context_s *cmd_ctx, ...@@ -286,9 +286,16 @@ static int handle_dap_info_command(struct command_context_s *cmd_ctx,
swjdp_common_t *swjdp = &armv7a->swjdp_info; swjdp_common_t *swjdp = &armv7a->swjdp_info;
uint32_t apsel; uint32_t apsel;
apsel = swjdp->apsel; switch (argc) {
if (argc > 0) case 0:
apsel = strtoul(args[0], NULL, 0); apsel = swjdp->apsel;
break;
case 1:
COMMAND_PARSE_NUMBER(u32, args[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
}
return dap_info_command(cmd_ctx, swjdp, apsel); return dap_info_command(cmd_ctx, swjdp, apsel);
} }
...@@ -320,10 +327,10 @@ handle_armv7a_disassemble_command(struct command_context_s *cmd_ctx, ...@@ -320,10 +327,10 @@ handle_armv7a_disassemble_command(struct command_context_s *cmd_ctx,
thumb = 1; thumb = 1;
/* FALL THROUGH */ /* FALL THROUGH */
case 2: case 2:
count = strtoul(args[1], NULL, 0); COMMAND_PARSE_NUMBER(int, args[1], count);
/* FALL THROUGH */ /* FALL THROUGH */
case 1: case 1:
address = strtoul(args[0], NULL, 0); COMMAND_PARSE_NUMBER(u32, args[0], address);
if (address & 0x01) { if (address & 0x01) {
if (!thumb) { if (!thumb) {
command_print(cmd_ctx, "Disassemble as Thumb"); command_print(cmd_ctx, "Disassemble as Thumb");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment