Allow the default input radix to be specified (iradix).
This commit is contained in:
parent
fd98116298
commit
fc808485c2
34
devcmd.c
34
devcmd.c
|
@ -175,16 +175,19 @@ int cmd_erase(char **arg)
|
||||||
int cmd_step(char **arg)
|
int cmd_step(char **arg)
|
||||||
{
|
{
|
||||||
char *count_text = get_arg(arg);
|
char *count_text = get_arg(arg);
|
||||||
int count = 1;
|
address_t count = 1;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (count_text)
|
if (count_text) {
|
||||||
count = atoi(count_text);
|
if (expr_eval(stab_default, count_text, &count) < 0) {
|
||||||
|
printc_err("step: can't parse count: %s\n", count_text);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (count > 0) {
|
for (i = 0; i < count; i++)
|
||||||
if (device_default->ctl(device_default, DEVICE_CTL_STEP) < 0)
|
if (device_default->ctl(device_default, DEVICE_CTL_STEP) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
count--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmd_regs(NULL);
|
return cmd_regs(NULL);
|
||||||
}
|
}
|
||||||
|
@ -557,13 +560,15 @@ int cmd_setbreak(char **arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index_text) {
|
if (index_text) {
|
||||||
index = atoi(index_text);
|
address_t val;
|
||||||
|
|
||||||
if (index < 0 || index >= device_default->max_breakpoints) {
|
if (expr_eval(stab_default, index_text, &val) < 0 ||
|
||||||
printc_err("setbreak: invalid breakpoint "
|
val >= device_default->max_breakpoints) {
|
||||||
"slot: %d\n", index);
|
printc("setbreak: invalid breakpoint slot: %d\n", val);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = device_setbrk(device_default, index, 1, addr);
|
index = device_setbrk(device_default, index, 1, addr);
|
||||||
|
@ -583,11 +588,12 @@ int cmd_delbreak(char **arg)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (index_text) {
|
if (index_text) {
|
||||||
int index = atoi(index_text);
|
address_t index;
|
||||||
|
|
||||||
if (index < 0 || index >= device_default->max_breakpoints) {
|
if (expr_eval(stab_default, index_text, &index) < 0 ||
|
||||||
printc_err("delbreak: invalid breakpoint "
|
index >= device_default->max_breakpoints) {
|
||||||
"slot: %d\n", index);
|
printc("delbreak: invalid breakpoint slot: %d\n",
|
||||||
|
index);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
expr.c
18
expr.c
|
@ -28,6 +28,7 @@
|
||||||
#include "stab.h"
|
#include "stab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
#include "opdb.h"
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Address expression parsing.
|
* Address expression parsing.
|
||||||
|
@ -52,13 +53,18 @@ static int addr_exp_data(stab_t stab,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hex value */
|
/* Hex value */
|
||||||
if (*text == '0' && text[1] == 'x')
|
if (*text == '0' && text[1] == 'x') {
|
||||||
value = strtoul(text + 2, NULL, 16);
|
value = strtoul(text + 2, NULL, 16);
|
||||||
else if (isdigit(*text))
|
} else if (*text == '0' && text[1] == 'd') {
|
||||||
value = atoi(text);
|
value = atoi(text + 2);
|
||||||
else if (stab_get(stab, text, &value) < 0) {
|
} else if (stab_get(stab, text, &value) < 0) {
|
||||||
printc_err("can't parse token: %s\n", text);
|
char *end;
|
||||||
return -1;
|
|
||||||
|
value = strtol(text, &end, opdb_get_numeric("iradix"));
|
||||||
|
if (*end) {
|
||||||
|
printc_err("can't parse token: %s\n", text);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->data_stack_size + 1 > ARRAY_LEN(s->data_stack)) {
|
if (s->data_stack_size + 1 > ARRAY_LEN(s->data_stack)) {
|
||||||
|
|
9
gdb.c
9
gdb.c
|
@ -33,6 +33,7 @@
|
||||||
#include "gdb.h"
|
#include "gdb.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
|
#include "expr.h"
|
||||||
|
|
||||||
#define MAX_MEM_XFER 8192
|
#define MAX_MEM_XFER 8192
|
||||||
|
|
||||||
|
@ -698,10 +699,12 @@ static int gdb_server(int port)
|
||||||
int cmd_gdb(char **arg)
|
int cmd_gdb(char **arg)
|
||||||
{
|
{
|
||||||
char *port_text = get_arg(arg);
|
char *port_text = get_arg(arg);
|
||||||
int port = 2000;
|
address_t port = 2000;
|
||||||
|
|
||||||
if (port_text)
|
if (port_text && expr_eval(stab_default, port_text, &port) < 0) {
|
||||||
port = atoi(port_text);
|
printc_err("gdb: can't parse port: %s\n", port_text);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (port <= 0 || port > 65535) {
|
if (port <= 0 || port > 65535) {
|
||||||
printc_err("gdb: invalid port: %d\n", port);
|
printc_err("gdb: invalid port: %d\n", port);
|
||||||
|
|
10
mspdebug.man
10
mspdebug.man
|
@ -389,8 +389,10 @@ Any command which accepts a memory address, length or register value
|
||||||
as an argument may be given an address expression. An address
|
as an argument may be given an address expression. An address
|
||||||
expression consists of an algebraic combination of values.
|
expression consists of an algebraic combination of values.
|
||||||
|
|
||||||
An address value may be either a decimal value, a hexadecimal value
|
An address value may be either a symbol name, a hex value preceeded
|
||||||
preceeded by the prefix \fB0x\fR, or a symbol name.
|
with the specifier "0x", a decimal value preceeded with the specifier
|
||||||
|
"0d", or a number in the default input radix (without a specifier). See
|
||||||
|
the option \fBiradix\fR for more information.
|
||||||
|
|
||||||
The operators recognised are the usual algebraic operators: \fB+\fR, \fB-\fR,
|
The operators recognised are the usual algebraic operators: \fB+\fR, \fB-\fR,
|
||||||
\fB*\fR, \fB/\fR, \fB%\fR, \fB(\fR and \fB)\fR. Operator precedence is the
|
\fB*\fR, \fB/\fR, \fB%\fR, \fB(\fR and \fB)\fR. Operator precedence is the
|
||||||
|
@ -416,6 +418,10 @@ If true, MSPDebug will colorize debugging output.
|
||||||
Automatically restart the GDB server after disconnection. If this
|
Automatically restart the GDB server after disconnection. If this
|
||||||
option is set, then the GDB server keeps running until an error occurs,
|
option is set, then the GDB server keeps running until an error occurs,
|
||||||
or the user interrupts with Ctrl+C.
|
or the user interrupts with Ctrl+C.
|
||||||
|
.IP "\fBiradix\fR (numeric)"
|
||||||
|
Default input radix for address expressions. For address values with
|
||||||
|
no radix specifier, this value gives the input radix, which is
|
||||||
|
10 (decimal) by default.
|
||||||
.IP "\fBquiet\fR (boolean)"
|
.IP "\fBquiet\fR (boolean)"
|
||||||
If set, MSPDebug will supress most of its debug-related output. This option
|
If set, MSPDebug will supress most of its debug-related output. This option
|
||||||
defaults to false, but can be set true on start-up using the \fB-q\fR
|
defaults to false, but can be set true on start-up using the \fB-q\fR
|
||||||
|
|
10
opdb.c
10
opdb.c
|
@ -43,10 +43,18 @@ const static struct opdb_key keys[] = {
|
||||||
{
|
{
|
||||||
.name = "quiet",
|
.name = "quiet",
|
||||||
.type = OPDB_TYPE_BOOLEAN,
|
.type = OPDB_TYPE_BOOLEAN,
|
||||||
.help = "Supress debugging output\n",
|
.help = "Supress debugging output.\n",
|
||||||
.defval = {
|
.defval = {
|
||||||
.boolean = 0
|
.boolean = 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "iradix",
|
||||||
|
.type = OPDB_TYPE_NUMERIC,
|
||||||
|
.help = "Default input radix.\n",
|
||||||
|
.defval = {
|
||||||
|
.numeric = 10
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue