@@ -305,14 +305,6 @@ static void gdb_gen_spr_feature(CPUState *cs)
unsigned int num_regs = 0;
int i;
- if (pcc->gdb_spr.xml) {
- return;
- }
-
- gdb_feature_builder_init(&builder, &pcc->gdb_spr,
- "org.qemu.power.spr", "power-spr.xml",
- cs->gdb_num_regs);
-
for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
ppc_spr_t *spr = &env->spr_cb[i];
@@ -320,9 +312,6 @@ static void gdb_gen_spr_feature(CPUState *cs)
continue;
}
- gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name, -1),
- TARGET_LONG_BITS, num_regs,
- "int", "spr");
/*
* GDB identifies registers based on the order they are
* presented in the XML. These ids will not match QEMU's
@@ -335,6 +324,26 @@ static void gdb_gen_spr_feature(CPUState *cs)
num_regs++;
}
+ if (pcc->gdb_spr.xml) {
+ return;
+ }
+
+ gdb_feature_builder_init(&builder, &pcc->gdb_spr,
+ "org.qemu.power.spr", "power-spr.xml",
+ cs->gdb_num_regs);
+
+ for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
+ ppc_spr_t *spr = &env->spr_cb[i];
+
+ if (!spr->name) {
+ continue;
+ }
+
+ gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name, -1),
+ TARGET_LONG_BITS, spr->gdb_id,
+ "int", "spr");
+ }
+
gdb_feature_builder_end(&builder);
}
#endif