LOCAL: target/xtensa: allow tweaking the list of registers sent to GDB

This commit introduces two environment variables which can be used
to adjust the list of registers sent from QEMU to GDB:
* If QEMU_XTENSA_CORE_REGS_ONLY is set, only non-privileged registers
  will be sent to GDB. This behavior is compatible with Espressif
  builds of GDB up to esp-2021r1.
* If QEMU_XTENSA_COUNT_WINDOW_REGS is set, QEMU will send window
  registers (a0-a15) to GDB. Enable this if you don't have a build of
  GDB which considers a0-a15 to be raw registers.
This commit is contained in:
Ivan Grokhotkov
2021-07-25 17:56:35 +02:00
parent 200797fb2f
commit 7a53fca9ab
2 changed files with 15 additions and 0 deletions
+6
View File
@@ -46,6 +46,12 @@ void xtensa_count_regs(const XtensaConfig *config,
unsigned i;
bool count_core_regs = true;
/* Espressif local: allow changing the behavior here based on QEMU_XTENSA_COUNT_WINDOW_REGS
* environment variable.
*/
const char* count_window_regs_env = getenv("QEMU_XTENSA_COUNT_WINDOW_REGS");
bool count_window_regs = count_window_regs_env != NULL && strcmp(count_window_regs_env, "0") != 0;
for (i = 0; config->gdb_regmap.reg[i].targno >= 0; ++i) {
if (config->gdb_regmap.reg[i].type != xtRegisterTypeTieState &&
config->gdb_regmap.reg[i].type != xtRegisterTypeMapped &&
+9
View File
@@ -185,6 +185,15 @@ static void xtensa_core_class_init(ObjectClass *oc, void *data)
* in the gdb/xtensa-config.c inside gdb source tree or inside gdb overlay.
*/
cc->gdb_num_core_regs = config->gdb_regmap.num_regs;
/* Espressif local: allow changing the behavior here using
* QEMU_XTENSA_CORE_REGS_ONLY environment variable, to support different
* GDB builds
*/
const char* core_regs_only = getenv("QEMU_XTENSA_CORE_REGS_ONLY");
if (core_regs_only != NULL && strcmp(core_regs_only, "0") != 0) {
cc->gdb_num_core_regs = config->gdb_regmap.num_core_regs;
}
}
void xtensa_register_core(XtensaConfigList *node)