cris: kgdb: use native hex2bin
There are kernel native helpers to convert hex ascii to the binary format: hex_to_bin() and hex2bin(). Thus, no need to reimplement them customly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Jesper Nilsson <jespern@axis.com>
This commit is contained in:
parent
6a13feb9c8
commit
4d0d39758d
@ -275,7 +275,7 @@ static char remcomOutBuffer[BUFMAX];
|
|||||||
/* Error and warning messages. */
|
/* Error and warning messages. */
|
||||||
enum error_type
|
enum error_type
|
||||||
{
|
{
|
||||||
SUCCESS, E01, E02, E03, E04, E05, E06, E07
|
SUCCESS, E01, E02, E03, E04, E05, E06, E07, E08
|
||||||
};
|
};
|
||||||
static char *error_message[] =
|
static char *error_message[] =
|
||||||
{
|
{
|
||||||
@ -286,7 +286,8 @@ static char *error_message[] =
|
|||||||
"E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
|
"E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
|
||||||
"E05 Change register content - P - the register is not implemented..",
|
"E05 Change register content - P - the register is not implemented..",
|
||||||
"E06 Change memory content - M - internal error.",
|
"E06 Change memory content - M - internal error.",
|
||||||
"E07 Change register content - P - the register is not stored on the stack"
|
"E07 Change register content - P - the register is not stored on the stack",
|
||||||
|
"E08 Invalid parameter"
|
||||||
};
|
};
|
||||||
/********************************* Register image ****************************/
|
/********************************* Register image ****************************/
|
||||||
/* Use the order of registers as defined in "AXIS ETRAX CRIS Programmer's
|
/* Use the order of registers as defined in "AXIS ETRAX CRIS Programmer's
|
||||||
@ -413,18 +414,6 @@ gdb_cris_strtol (const char *s, char **endptr, int base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/********************************** Packet I/O ******************************/
|
/********************************** Packet I/O ******************************/
|
||||||
/* Returns the integer equivalent of a hexadecimal character. */
|
|
||||||
static int
|
|
||||||
hex (char ch)
|
|
||||||
{
|
|
||||||
if ((ch >= 'a') && (ch <= 'f'))
|
|
||||||
return (ch - 'a' + 10);
|
|
||||||
if ((ch >= '0') && (ch <= '9'))
|
|
||||||
return (ch - '0');
|
|
||||||
if ((ch >= 'A') && (ch <= 'F'))
|
|
||||||
return (ch - 'A' + 10);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
||||||
Put the result in buf, and return a pointer to the last character
|
Put the result in buf, and return a pointer to the last character
|
||||||
@ -455,22 +444,6 @@ mem2hex(char *buf, unsigned char *mem, int count)
|
|||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the array, in hexadecimal representation, pointed to by buf into
|
|
||||||
binary representation. Put the result in mem, and return a pointer to
|
|
||||||
the character after the last byte written. */
|
|
||||||
static unsigned char*
|
|
||||||
hex2mem (unsigned char *mem, char *buf, int count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char ch;
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
ch = hex (*buf++) << 4;
|
|
||||||
ch = ch + hex (*buf++);
|
|
||||||
*mem++ = ch;
|
|
||||||
}
|
|
||||||
return (mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put the content of the array, in binary representation, pointed to by buf
|
/* Put the content of the array, in binary representation, pointed to by buf
|
||||||
into memory pointed to by mem, and return a pointer to the character after
|
into memory pointed to by mem, and return a pointer to the character after
|
||||||
the last byte written.
|
the last byte written.
|
||||||
@ -524,8 +497,8 @@ getpacket (char *buffer)
|
|||||||
buffer[count] = '\0';
|
buffer[count] = '\0';
|
||||||
|
|
||||||
if (ch == '#') {
|
if (ch == '#') {
|
||||||
xmitcsum = hex (getDebugChar ()) << 4;
|
xmitcsum = hex_to_bin(getDebugChar()) << 4;
|
||||||
xmitcsum += hex (getDebugChar ());
|
xmitcsum += hex_to_bin(getDebugChar());
|
||||||
if (checksum != xmitcsum) {
|
if (checksum != xmitcsum) {
|
||||||
/* Wrong checksum */
|
/* Wrong checksum */
|
||||||
putDebugChar ('-');
|
putDebugChar ('-');
|
||||||
@ -599,7 +572,7 @@ putDebugString (const unsigned char *str, int length)
|
|||||||
|
|
||||||
/********************************* Register image ****************************/
|
/********************************* Register image ****************************/
|
||||||
/* Write a value to a specified register in the register image of the current
|
/* Write a value to a specified register in the register image of the current
|
||||||
thread. Returns status code SUCCESS, E02 or E05. */
|
thread. Returns status code SUCCESS, E02, E05 or E08. */
|
||||||
static int
|
static int
|
||||||
write_register (int regno, char *val)
|
write_register (int regno, char *val)
|
||||||
{
|
{
|
||||||
@ -608,8 +581,9 @@ write_register (int regno, char *val)
|
|||||||
|
|
||||||
if (regno >= R0 && regno <= PC) {
|
if (regno >= R0 && regno <= PC) {
|
||||||
/* 32-bit register with simple offset. */
|
/* 32-bit register with simple offset. */
|
||||||
hex2mem ((unsigned char *)current_reg + regno * sizeof(unsigned int),
|
if (hex2bin((unsigned char *)current_reg + regno * sizeof(unsigned int),
|
||||||
val, sizeof(unsigned int));
|
val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
}
|
}
|
||||||
else if (regno == P0 || regno == VR || regno == P4 || regno == P8) {
|
else if (regno == P0 || regno == VR || regno == P4 || regno == P8) {
|
||||||
/* Do not support read-only registers. */
|
/* Do not support read-only registers. */
|
||||||
@ -618,13 +592,15 @@ write_register (int regno, char *val)
|
|||||||
else if (regno == CCR) {
|
else if (regno == CCR) {
|
||||||
/* 16 bit register with complex offset. (P4 is read-only, P6 is not implemented,
|
/* 16 bit register with complex offset. (P4 is read-only, P6 is not implemented,
|
||||||
and P7 (MOF) is 32 bits in ETRAX 100LX. */
|
and P7 (MOF) is 32 bits in ETRAX 100LX. */
|
||||||
hex2mem ((unsigned char *)&(current_reg->ccr) + (regno-CCR) * sizeof(unsigned short),
|
if (hex2bin((unsigned char *)&(current_reg->ccr) + (regno-CCR) * sizeof(unsigned short),
|
||||||
val, sizeof(unsigned short));
|
val, sizeof(unsigned short)))
|
||||||
|
status = E08;
|
||||||
}
|
}
|
||||||
else if (regno >= MOF && regno <= USP) {
|
else if (regno >= MOF && regno <= USP) {
|
||||||
/* 32 bit register with complex offset. (P8 has been taken care of.) */
|
/* 32 bit register with complex offset. (P8 has been taken care of.) */
|
||||||
hex2mem ((unsigned char *)&(current_reg->ibr) + (regno-IBR) * sizeof(unsigned int),
|
if (hex2bin((unsigned char *)&(current_reg->ibr) + (regno-IBR) * sizeof(unsigned int),
|
||||||
val, sizeof(unsigned int));
|
val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
|
/* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
|
||||||
@ -759,9 +735,11 @@ handle_exception (int sigval)
|
|||||||
/* Write registers. GXX..XX
|
/* Write registers. GXX..XX
|
||||||
Each byte of register data is described by two hex digits.
|
Each byte of register data is described by two hex digits.
|
||||||
Success: OK
|
Success: OK
|
||||||
Failure: void. */
|
Failure: E08. */
|
||||||
hex2mem((char *)&cris_reg, &remcomInBuffer[1], sizeof(registers));
|
if (hex2bin((char *)&cris_reg, &remcomInBuffer[1], sizeof(registers)))
|
||||||
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
gdb_cris_strcpy (remcomOutBuffer, error_message[E08]);
|
||||||
|
else
|
||||||
|
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
@ -771,7 +749,7 @@ handle_exception (int sigval)
|
|||||||
for each byte in the register (target byte order). P1f=11223344 means
|
for each byte in the register (target byte order). P1f=11223344 means
|
||||||
set register 31 to 44332211.
|
set register 31 to 44332211.
|
||||||
Success: OK
|
Success: OK
|
||||||
Failure: E02, E05 */
|
Failure: E02, E05, E08 */
|
||||||
{
|
{
|
||||||
char *suffix;
|
char *suffix;
|
||||||
int regno = gdb_cris_strtol (&remcomInBuffer[1], &suffix, 16);
|
int regno = gdb_cris_strtol (&remcomInBuffer[1], &suffix, 16);
|
||||||
@ -791,6 +769,10 @@ handle_exception (int sigval)
|
|||||||
/* Do not support non-existing registers on the stack. */
|
/* Do not support non-existing registers on the stack. */
|
||||||
gdb_cris_strcpy (remcomOutBuffer, error_message[E07]);
|
gdb_cris_strcpy (remcomOutBuffer, error_message[E07]);
|
||||||
break;
|
break;
|
||||||
|
case E08:
|
||||||
|
/* Invalid parameter. */
|
||||||
|
gdb_cris_strcpy (remcomOutBuffer, error_message[E08]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Valid register number. */
|
/* Valid register number. */
|
||||||
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
||||||
@ -826,7 +808,7 @@ handle_exception (int sigval)
|
|||||||
AA..AA is the start address, LLLL is the number of bytes, and
|
AA..AA is the start address, LLLL is the number of bytes, and
|
||||||
XX..XX is the hexadecimal data.
|
XX..XX is the hexadecimal data.
|
||||||
Success: OK
|
Success: OK
|
||||||
Failure: void. */
|
Failure: E08. */
|
||||||
{
|
{
|
||||||
char *lenptr;
|
char *lenptr;
|
||||||
char *dataptr;
|
char *dataptr;
|
||||||
@ -835,14 +817,15 @@ handle_exception (int sigval)
|
|||||||
int length = gdb_cris_strtol(lenptr+1, &dataptr, 16);
|
int length = gdb_cris_strtol(lenptr+1, &dataptr, 16);
|
||||||
if (*lenptr == ',' && *dataptr == ':') {
|
if (*lenptr == ',' && *dataptr == ':') {
|
||||||
if (remcomInBuffer[0] == 'M') {
|
if (remcomInBuffer[0] == 'M') {
|
||||||
hex2mem(addr, dataptr + 1, length);
|
if (hex2bin(addr, dataptr + 1, length))
|
||||||
}
|
gdb_cris_strcpy (remcomOutBuffer, error_message[E08]);
|
||||||
else /* X */ {
|
else
|
||||||
|
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
||||||
|
} else /* X */ {
|
||||||
bin2mem(addr, dataptr + 1, length);
|
bin2mem(addr, dataptr + 1, length);
|
||||||
|
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
||||||
}
|
}
|
||||||
gdb_cris_strcpy (remcomOutBuffer, "OK");
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
gdb_cris_strcpy (remcomOutBuffer, error_message[E06]);
|
gdb_cris_strcpy (remcomOutBuffer, error_message[E06]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,19 +384,11 @@ int getDebugChar(void);
|
|||||||
/* Serial port, writes one character. ETRAX 100 specific. from debugport.c */
|
/* Serial port, writes one character. ETRAX 100 specific. from debugport.c */
|
||||||
void putDebugChar(int val);
|
void putDebugChar(int val);
|
||||||
|
|
||||||
/* Returns the integer equivalent of a hexadecimal character. */
|
|
||||||
static int hex(char ch);
|
|
||||||
|
|
||||||
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
||||||
Put the result in buf, and return a pointer to the last character
|
Put the result in buf, and return a pointer to the last character
|
||||||
in buf (null). */
|
in buf (null). */
|
||||||
static char *mem2hex(char *buf, unsigned char *mem, int count);
|
static char *mem2hex(char *buf, unsigned char *mem, int count);
|
||||||
|
|
||||||
/* Convert the array, in hexadecimal representation, pointed to by buf into
|
|
||||||
binary representation. Put the result in mem, and return a pointer to
|
|
||||||
the character after the last byte written. */
|
|
||||||
static unsigned char *hex2mem(unsigned char *mem, char *buf, int count);
|
|
||||||
|
|
||||||
/* Put the content of the array, in binary representation, pointed to by buf
|
/* Put the content of the array, in binary representation, pointed to by buf
|
||||||
into memory pointed to by mem, and return a pointer to
|
into memory pointed to by mem, and return a pointer to
|
||||||
the character after the last byte written. */
|
the character after the last byte written. */
|
||||||
@ -449,7 +441,7 @@ static char output_buffer[BUFMAX];
|
|||||||
/* Error and warning messages. */
|
/* Error and warning messages. */
|
||||||
enum error_type
|
enum error_type
|
||||||
{
|
{
|
||||||
SUCCESS, E01, E02, E03, E04, E05, E06,
|
SUCCESS, E01, E02, E03, E04, E05, E06, E07, E08
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *error_message[] =
|
static char *error_message[] =
|
||||||
@ -461,6 +453,8 @@ static char *error_message[] =
|
|||||||
"E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
|
"E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
|
||||||
"E05 Change register content - P - the register is not implemented..",
|
"E05 Change register content - P - the register is not implemented..",
|
||||||
"E06 Change memory content - M - internal error.",
|
"E06 Change memory content - M - internal error.",
|
||||||
|
"E07 Change register content - P - the register is not stored on the stack",
|
||||||
|
"E08 Invalid parameter"
|
||||||
};
|
};
|
||||||
|
|
||||||
/********************************** Breakpoint *******************************/
|
/********************************** Breakpoint *******************************/
|
||||||
@ -539,7 +533,7 @@ gdb_cris_strtol(const char *s, char **endptr, int base)
|
|||||||
/********************************* Register image ****************************/
|
/********************************* Register image ****************************/
|
||||||
|
|
||||||
/* Write a value to a specified register in the register image of the current
|
/* Write a value to a specified register in the register image of the current
|
||||||
thread. Returns status code SUCCESS, E02 or E05. */
|
thread. Returns status code SUCCESS, E02, E05 or E08. */
|
||||||
static int
|
static int
|
||||||
write_register(int regno, char *val)
|
write_register(int regno, char *val)
|
||||||
{
|
{
|
||||||
@ -547,8 +541,9 @@ write_register(int regno, char *val)
|
|||||||
|
|
||||||
if (regno >= R0 && regno <= ACR) {
|
if (regno >= R0 && regno <= ACR) {
|
||||||
/* Consecutive 32-bit registers. */
|
/* Consecutive 32-bit registers. */
|
||||||
hex2mem((unsigned char *)®.r0 + (regno - R0) * sizeof(unsigned int),
|
if (hex2bin((unsigned char *)®.r0 + (regno - R0) * sizeof(unsigned int),
|
||||||
val, sizeof(unsigned int));
|
val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
|
|
||||||
} else if (regno == BZ || regno == VR || regno == WZ || regno == DZ) {
|
} else if (regno == BZ || regno == VR || regno == WZ || regno == DZ) {
|
||||||
/* Read-only registers. */
|
/* Read-only registers. */
|
||||||
@ -557,16 +552,19 @@ write_register(int regno, char *val)
|
|||||||
} else if (regno == PID) {
|
} else if (regno == PID) {
|
||||||
/* 32-bit register. (Even though we already checked SRS and WZ, we cannot
|
/* 32-bit register. (Even though we already checked SRS and WZ, we cannot
|
||||||
combine this with the EXS - SPC write since SRS and WZ have different size.) */
|
combine this with the EXS - SPC write since SRS and WZ have different size.) */
|
||||||
hex2mem((unsigned char *)®.pid, val, sizeof(unsigned int));
|
if (hex2bin((unsigned char *)®.pid, val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
|
|
||||||
} else if (regno == SRS) {
|
} else if (regno == SRS) {
|
||||||
/* 8-bit register. */
|
/* 8-bit register. */
|
||||||
hex2mem((unsigned char *)®.srs, val, sizeof(unsigned char));
|
if (hex2bin((unsigned char *)®.srs, val, sizeof(unsigned char)))
|
||||||
|
status = E08;
|
||||||
|
|
||||||
} else if (regno >= EXS && regno <= SPC) {
|
} else if (regno >= EXS && regno <= SPC) {
|
||||||
/* Consecutive 32-bit registers. */
|
/* Consecutive 32-bit registers. */
|
||||||
hex2mem((unsigned char *)®.exs + (regno - EXS) * sizeof(unsigned int),
|
if (hex2bin((unsigned char *)®.exs + (regno - EXS) * sizeof(unsigned int),
|
||||||
val, sizeof(unsigned int));
|
val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
|
|
||||||
} else if (regno == PC) {
|
} else if (regno == PC) {
|
||||||
/* Pseudo-register. Treat as read-only. */
|
/* Pseudo-register. Treat as read-only. */
|
||||||
@ -574,7 +572,9 @@ write_register(int regno, char *val)
|
|||||||
|
|
||||||
} else if (regno >= S0 && regno <= S15) {
|
} else if (regno >= S0 && regno <= S15) {
|
||||||
/* 32-bit registers. */
|
/* 32-bit registers. */
|
||||||
hex2mem((unsigned char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int), val, sizeof(unsigned int));
|
if (hex2bin((unsigned char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int),
|
||||||
|
val, sizeof(unsigned int)))
|
||||||
|
status = E08;
|
||||||
} else {
|
} else {
|
||||||
/* Non-existing register. */
|
/* Non-existing register. */
|
||||||
status = E05;
|
status = E05;
|
||||||
@ -630,19 +630,6 @@ read_register(char regno, unsigned int *valptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/********************************** Packet I/O ******************************/
|
/********************************** Packet I/O ******************************/
|
||||||
/* Returns the integer equivalent of a hexadecimal character. */
|
|
||||||
static int
|
|
||||||
hex(char ch)
|
|
||||||
{
|
|
||||||
if ((ch >= 'a') && (ch <= 'f'))
|
|
||||||
return (ch - 'a' + 10);
|
|
||||||
if ((ch >= '0') && (ch <= '9'))
|
|
||||||
return (ch - '0');
|
|
||||||
if ((ch >= 'A') && (ch <= 'F'))
|
|
||||||
return (ch - 'A' + 10);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
/* Convert the memory, pointed to by mem into hexadecimal representation.
|
||||||
Put the result in buf, and return a pointer to the last character
|
Put the result in buf, and return a pointer to the last character
|
||||||
in buf (null). */
|
in buf (null). */
|
||||||
@ -689,22 +676,6 @@ mem2hex_nbo(char *buf, unsigned char *mem, int count)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the array, in hexadecimal representation, pointed to by buf into
|
|
||||||
binary representation. Put the result in mem, and return a pointer to
|
|
||||||
the character after the last byte written. */
|
|
||||||
static unsigned char*
|
|
||||||
hex2mem(unsigned char *mem, char *buf, int count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char ch;
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
ch = hex (*buf++) << 4;
|
|
||||||
ch = ch + hex (*buf++);
|
|
||||||
*mem++ = ch;
|
|
||||||
}
|
|
||||||
return mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put the content of the array, in binary representation, pointed to by buf
|
/* Put the content of the array, in binary representation, pointed to by buf
|
||||||
into memory pointed to by mem, and return a pointer to the character after
|
into memory pointed to by mem, and return a pointer to the character after
|
||||||
the last byte written.
|
the last byte written.
|
||||||
@ -763,8 +734,8 @@ getpacket(char *buffer)
|
|||||||
buffer[count] = 0;
|
buffer[count] = 0;
|
||||||
|
|
||||||
if (ch == '#') {
|
if (ch == '#') {
|
||||||
xmitcsum = hex(getDebugChar()) << 4;
|
xmitcsum = hex_to_bin(getDebugChar()) << 4;
|
||||||
xmitcsum += hex(getDebugChar());
|
xmitcsum += hex_to_bin(getDebugChar());
|
||||||
if (checksum != xmitcsum) {
|
if (checksum != xmitcsum) {
|
||||||
/* Wrong checksum */
|
/* Wrong checksum */
|
||||||
putDebugChar('-');
|
putDebugChar('-');
|
||||||
@ -1304,14 +1275,17 @@ handle_exception(int sigval)
|
|||||||
/* Write registers. GXX..XX
|
/* Write registers. GXX..XX
|
||||||
Each byte of register data is described by two hex digits.
|
Each byte of register data is described by two hex digits.
|
||||||
Success: OK
|
Success: OK
|
||||||
Failure: void. */
|
Failure: E08. */
|
||||||
/* General and special registers. */
|
/* General and special registers. */
|
||||||
hex2mem((char *)®, &input_buffer[1], sizeof(registers));
|
if (hex2bin((char *)®, &input_buffer[1], sizeof(registers)))
|
||||||
|
gdb_cris_strcpy(output_buffer, error_message[E08]);
|
||||||
/* Support registers. */
|
/* Support registers. */
|
||||||
hex2mem((char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
|
else if (hex2bin((char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
|
||||||
&input_buffer[1] + sizeof(registers),
|
&input_buffer[1] + sizeof(registers),
|
||||||
16 * sizeof(unsigned int));
|
16 * sizeof(unsigned int)))
|
||||||
gdb_cris_strcpy(output_buffer, "OK");
|
gdb_cris_strcpy(output_buffer, error_message[E08]);
|
||||||
|
else
|
||||||
|
gdb_cris_strcpy(output_buffer, "OK");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
@ -1338,6 +1312,10 @@ handle_exception(int sigval)
|
|||||||
/* Do not support non-existing registers. */
|
/* Do not support non-existing registers. */
|
||||||
gdb_cris_strcpy(output_buffer, error_message[E05]);
|
gdb_cris_strcpy(output_buffer, error_message[E05]);
|
||||||
break;
|
break;
|
||||||
|
case E08:
|
||||||
|
/* Invalid parameter. */
|
||||||
|
gdb_cris_strcpy(output_buffer, error_message[E08]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Valid register number. */
|
/* Valid register number. */
|
||||||
gdb_cris_strcpy(output_buffer, "OK");
|
gdb_cris_strcpy(output_buffer, "OK");
|
||||||
@ -1380,7 +1358,7 @@ handle_exception(int sigval)
|
|||||||
AA..AA is the start address, LLLL is the number of bytes, and
|
AA..AA is the start address, LLLL is the number of bytes, and
|
||||||
XX..XX is the hexadecimal data.
|
XX..XX is the hexadecimal data.
|
||||||
Success: OK
|
Success: OK
|
||||||
Failure: void. */
|
Failure: E08. */
|
||||||
{
|
{
|
||||||
char *lenptr;
|
char *lenptr;
|
||||||
char *dataptr;
|
char *dataptr;
|
||||||
@ -1389,13 +1367,15 @@ handle_exception(int sigval)
|
|||||||
int len = gdb_cris_strtol(lenptr+1, &dataptr, 16);
|
int len = gdb_cris_strtol(lenptr+1, &dataptr, 16);
|
||||||
if (*lenptr == ',' && *dataptr == ':') {
|
if (*lenptr == ',' && *dataptr == ':') {
|
||||||
if (input_buffer[0] == 'M') {
|
if (input_buffer[0] == 'M') {
|
||||||
hex2mem(addr, dataptr + 1, len);
|
if (hex2bin(addr, dataptr + 1, len))
|
||||||
|
gdb_cris_strcpy(output_buffer, error_message[E08]);
|
||||||
|
else
|
||||||
|
gdb_cris_strcpy(output_buffer, "OK");
|
||||||
} else /* X */ {
|
} else /* X */ {
|
||||||
bin2mem(addr, dataptr + 1, len);
|
bin2mem(addr, dataptr + 1, len);
|
||||||
|
gdb_cris_strcpy(output_buffer, "OK");
|
||||||
}
|
}
|
||||||
gdb_cris_strcpy(output_buffer, "OK");
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
gdb_cris_strcpy(output_buffer, error_message[E06]);
|
gdb_cris_strcpy(output_buffer, error_message[E06]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user