fix last commit; we need to support hex addresses too

This commit is contained in:
Richard Goedeken 2018-10-19 19:13:22 -07:00
parent 0dc8782b4d
commit cbbfeaad14

View file

@ -237,7 +237,9 @@ int debugger_loop(void *arg) {
uint32_t readAddr, length=1, rows=1, size=4;
uint32_t i, j;
char chSize;
if (sscanf(input, "mem /%ux%u%c %u", &rows, &length, &chSize, &readAddr) == 4 && (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd'))
if ((sscanf(input, "mem /%ux%u%c %x", &rows, &length, &chSize, &readAddr) == 4 ||
sscanf(input, "mem /%ux%u%c %u", &rows, &length, &chSize, &readAddr) == 4)
&& (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd'))
{
if (chSize == 'b')
size = 1;
@ -248,10 +250,13 @@ int debugger_loop(void *arg) {
else // chSize == 'd'
size = 8;
}
else if (sscanf(input, "mem /%ux%u %u", &rows, &length, &readAddr) == 3)
else if (sscanf(input, "mem /%ux%u %x", &rows, &length, &readAddr) == 3 ||
sscanf(input, "mem /%ux%u %u", &rows, &length, &readAddr) == 3)
{
}
else if (sscanf(input, "mem /%u%c %u", &length, &chSize, &readAddr) == 3 && (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd'))
else if ((sscanf(input, "mem /%u%c %x", &length, &chSize, &readAddr) == 3 ||
sscanf(input, "mem /%u%c %u", &length, &chSize, &readAddr) == 3)
&& (chSize == 'b' || chSize == 'h' || chSize == 'w' || chSize == 'd'))
{
rows = 1;
if (chSize == 'b')
@ -263,11 +268,13 @@ int debugger_loop(void *arg) {
else // chSize == 'd'
size = 8;
}
else if (sscanf(input, "mem /%u %u", &length, &readAddr) == 2)
else if (sscanf(input, "mem /%u %x", &length, &readAddr) == 2 ||
sscanf(input, "mem /%u %u", &length, &readAddr) == 2)
{
rows = 1;
}
else if (sscanf(input, "mem %u", &readAddr) == 1)
else if (sscanf(input, "mem %x", &readAddr) == 1 ||
sscanf(input, "mem %u", &readAddr) == 1)
{
rows = 1;
length = 1;