GDB: Added support for memory read.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2019-02-05 15:59:27 +01:00 committed by Janusz Jankowski
parent 9e1bed23aa
commit aae1c4c1d0
2 changed files with 16 additions and 0 deletions

View File

@ -309,6 +309,19 @@ while (1) {
strcpy((char *)remcom_out_buffer, "OK");
}
break;
/* read memory */
case 'm':
i = hex_to_int(&request, &addr);
if (i == VALID_MEM_ADDRESS_LEN &&
((addr & FIRST_BYTE_MASK) >> 28) == VALID_MEM_START_BYTE &&
*request++ == ',' && hex_to_int(&request, &length)) {
if (mem_to_hex((void *)addr, remcom_out_buffer, length))
break;
strcpy((char *)remcom_out_buffer, "E03");
} else {
strcpy((char *)remcom_out_buffer, "E01");
}
break;
default:
gdb_log_exception("Unknown GDB command.");
break;

View File

@ -5,6 +5,9 @@
#define GDB_NUMBER_OF_REGISTERS 64
#define DISABLE_LOWER_INTERRUPTS_MASK ~0x1F
#define REGISTER_MASK 0xFF
#define FIRST_BYTE_MASK 0xF0000000
#define VALID_MEM_START_BYTE 0xB
#define VALID_MEM_ADDRESS_LEN 0x8
void gdb_handle_exception(void);
void gdb_debug_info(unsigned char *str);
void gdb_init_debug_exception(void);