]> git.sur5r.net Git - openocd/commitdiff
Improve trace command argument parsing.
authorZachary T Welch <zw@superlucidity.net>
Sat, 24 Oct 2009 13:36:06 +0000 (06:36 -0700)
committerZachary T Welch <zw@superlucidity.net>
Fri, 6 Nov 2009 02:03:19 +0000 (18:03 -0800)
src/target/trace.c

index 9387f8304bde72b008021ef2cb37bd62037db6cd..e74c6160ffff7e68a16d676e729cab5f1658b05c 100644 (file)
@@ -86,7 +86,9 @@ static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *c
                trace->trace_points_size += 32;
        }
 
-       trace->trace_points[trace->num_trace_points].address = strtoul(args[0], NULL, 0);
+       uint32_t address;
+       COMMAND_PARSE_NUMBER(u32, args[0], address);
+       trace->trace_points[trace->num_trace_points].address = address;
        trace->trace_points[trace->num_trace_points].hit_counter = 0;
        trace->num_trace_points++;
 
@@ -112,7 +114,7 @@ static int handle_trace_history_command(struct command_context_s *cmd_ctx, char
                if (trace->trace_history)
                        free(trace->trace_history);
 
-               trace->trace_history_size = strtoul(args[0], NULL, 0);
+               COMMAND_PARSE_NUMBER(u32, args[0], trace->trace_history_size);
                trace->trace_history = malloc(sizeof(uint32_t) * trace->trace_history_size);
 
                command_print(cmd_ctx, "new trace history size: %i", (int)(trace->trace_history_size));