]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/ppc: Fix GDB register indexing on secondary CPUs
authorBenjamin Gray <bgray@linux.ibm.com>
Wed, 20 Mar 2024 01:50:25 +0000 (12:50 +1100)
committerNicholas Piggin <npiggin@gmail.com>
Sat, 30 Mar 2024 08:50:24 +0000 (18:50 +1000)
commited399ade3c85adf82fe507339560693e83a27020
tree00efd4e1d0e90120e59b740f50aa9024dcbd1133
parent978897a572e975faad912a473815a668a43d9f1f
target/ppc: Fix GDB register indexing on secondary CPUs

The GDB server protocol assigns an arbitrary numbering of the SPRs.
We track this correspondence on each SPR with gdb_id, using it to
resolve any SPR requests GDB makes.

Early on we generate an XML representation of the SPRs to give GDB,
including this numbering. However the XML is cached globally, and we
skip setting the SPR gdb_id values on subsequent threads if we detect
it is cached. This causes QEMU to fail to resolve SPR requests against
secondary CPUs because it cannot find the matching gdb_id value on that
thread's SPRs.

This is a minimal fix to first assign the gdb_id values, then return
early if the XML is cached. Otherwise we generate the XML using the
now already initialised gdb_id values.

Fixes: 1b53948ff8f7 ("target/ppc: Use GDBFeature for dynamic XML")
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
target/ppc/gdbstub.c