step command now takes a count argument.

This commit is contained in:
Daniel Beer 2010-03-20 15:22:58 +13:00
parent 0d71fcef38
commit 8c20233297
2 changed files with 17 additions and 5 deletions

11
main.c
View File

@ -455,8 +455,17 @@ static int cmd_set(char **arg)
static int cmd_step(char **arg) static int cmd_step(char **arg)
{ {
char *count_text = get_arg(arg);
int count = 1;
if (count_text)
count = atoi(count_text);
while (count > 0) {
if (msp430_dev->control(DEVICE_CTL_STEP) < 0) if (msp430_dev->control(DEVICE_CTL_STEP) < 0)
return -1; return -1;
count--;
}
return cmd_regs(NULL); return cmd_regs(NULL);
} }
@ -661,7 +670,7 @@ static const struct command all_commands[] = {
"set <register> <value>\n" "set <register> <value>\n"
" Change the value of a CPU register.\n"}, " Change the value of a CPU register.\n"},
{"step", cmd_step, {"step", cmd_step,
"step\n" "step [count]\n"
" Single-step the CPU, and display the register state.\n"}, " Single-step the CPU, and display the register state.\n"},
{"syms", cmd_syms, {"syms", cmd_syms,
"syms <filename>\n" "syms <filename>\n"

View File

@ -143,10 +143,13 @@ Alter the value of a register. Registers are specified as numbers from
0 through 15. Any leading non-numeric characters are ignored (so a 0 through 15. Any leading non-numeric characters are ignored (so a
register may be specified as, for example, "R12"). The value argument register may be specified as, for example, "R12"). The value argument
is an address expression. is an address expression.
.IP "step" .IP "step [\fIcount\fR]"
Step the CPU through a single instruction. After stepping, the new Step the CPU through one or more instructions. After stepping, the new
register values are displayed, as well as a disassembly of the register values are displayed, as well as a disassembly of the
instructions at the address selected by the program counter. instructions at the address selected by the program counter.
An optional count can be specified to step multiple times. If no
argument is given, the CPU steps once.
.IP "syms \fIfilename\fR" .IP "syms \fIfilename\fR"
Load symbols from the specified file and add them to the symbol table. Load symbols from the specified file and add them to the symbol table.
The file format will be auto-detected and may be either ELF32 or a The file format will be auto-detected and may be either ELF32 or a