Skip to content

Commit

Permalink
target/ppc: Fix GDB SPR regnum indexing
Browse files Browse the repository at this point in the history
Fix an off by one bug.

Fixes: 1b53948 ("target/ppc: Use GDBFeature for dynamic XML")
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
  • Loading branch information
npiggin committed Mar 12, 2024
1 parent 35ac683 commit 99ea316
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions target/ppc/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ 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
Expand All @@ -334,10 +337,6 @@ static void gdb_gen_spr_feature(CPUState *cs)
*/
spr->gdb_id = num_regs;
num_regs++;

gdb_feature_builder_append_reg(&builder, g_ascii_strdown(spr->name, -1),
TARGET_LONG_BITS, num_regs,
"int", "spr");
}

gdb_feature_builder_end(&builder);
Expand Down

0 comments on commit 99ea316

Please sign in to comment.