Commit e0930f667a for qemu.org

commit e0930f667a44aad84a9bd01738bd5eaaa29b658d
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
Date:   Wed Mar 11 00:20:39 2026 +0100

    gdbstub: Emit base_register index in GDBFeature entries

    Record the base register index in the generated C file.

    Check at runtime that either @g_pos argument of
    gdb_register_coprocessor() is zero, or it the base register
    index.

    This change pass 'make check-tcg' test suite, which runs the
    tests/tcg/multiarch/gdbstub/registers.py test, itself calling
    gdb_register_coprocessor() for each target tested.

    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
    Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
    Link: https://lore.kernel.org/qemu-devel/20260310232045.58440-12-philmd@linaro.org
    Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 79e47a024e..75eb4d9c36 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -6,6 +6,7 @@ typedef struct GDBFeature {
     const char *xml;
     const char *name;
     const char * const *regs;
+    int base_reg;
     int num_regs;
 } GDBFeature;

diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py
index 1329695ad0..a52cd2e9ec 100644
--- a/scripts/feature_to_c.py
+++ b/scripts/feature_to_c.py
@@ -102,6 +102,7 @@ def writeliteral(indent, bytes):
         sys.stdout.write(',\n')

     sys.stdout.write( '        },\n')
+    sys.stdout.write(f'        .base_reg = {base_reg},\n')
     sys.stdout.write(f'        .num_regs = {num_regs},\n')
     sys.stdout.write( '    },\n')