target/arm: gdbstub system registers refinement
cover target/arm: gdbstub system registers refinement
This was working toward fixing
https://bugs.linaro.org/show_bug.cgi?id=4274
although I don't think I'm entirely successful. I would argue, however, that gdb's behaviour in this is odd. Why are registers that are clearly marked "system" being added to "general" simply because they have integer type?
In the meantime, we don't really need to present these registers to the user for CONFIG_USER_ONLY.
r~
Richard Henderson (2):
target/arm: Put system registers in "system" group target/arm: Don't add system-registers.xml for user-only
target/arm/gdbstub.c | 2 +- target/arm/helper.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.2
PATCH 1/2 target/arm: Put system registers in "system" group
The system group is predefined within gdb. While the spec seems to allow arbitrary group names, that seems to mess up the addition of all registers to any groups.
--- target/arm/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/gdbstub.c +1 -1
@@ -113,7 +113,7 @@ static void arm_gen_one_xml_reg_tag(GString *s, DynamicGDBXMLInfo *dyn_xml, {g_string_append_printf (s,"<reg name=\"%s\"" , ri->name);g_string_append_printf (s," bitsize=\"%d\"" , bitsize); -g_string_append_printf (s," group=\"cp_regs\"/>" ); +g_string_append_printf (s," group=\"system\"/>" ); dyn_xml->num_cpregs++; dyn_xml->cpregs_keys[dyn_xml->num_cpregs -1 ] = ri_key; }
Signature · 1 line
2.17.2
PATCH 2/2 target/arm: Don't add system-registers.xml for user-only
In reply to Richard HendersonThe system registers aren't that interesting for debugging user binaries. Avoid adding them in this case.
--- target/arm/helper.c | 4 ++++ 1 file changed, 4 insertions(+)
target/arm/helper.c +4 -0
@@ -221,6 +221,7 @@ static void write_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri, } } +#ifndef CONFIG_USER_ONLY static int arm_gdb_get_sysreg (CPUARMState *env,uint8_t *buf,int reg) {ARMCPU *cpu =arm_env_get_cpu (env);
@@ -243,6 +244,7 @@ static int arm_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) {return 0 ; } +#endif static bool raw_accessors_invalid (const ARMCPRegInfo *ri) {
@@ -6694,9 +6696,11 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)gdb_register_coprocessor (cs, vfp_gdb_get_reg, vfp_gdb_set_reg,19 ,"arm-vfp.xml" ,0 ); } +#ifndef CONFIG_USER_ONLY gdb_register_coprocessor (cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg,arm_gen_dynamic_xml (cs),"system-registers.xml" ,0 ); +#endif }/* Sort alphabetically by type name, except for "any". */
Signature · 1 line
2.17.2
Quoted 9 lines · Richard Henderson
This was working toward fixing
https://bugs.linaro.org/show_bug.cgi?id=4274
although I don't think I'm entirely successful. I would argue, however, that gdb's behaviour in this is odd. Why are registers that are clearly marked "system" being added to "general" simply because they have integer type?
Yeah, this does seem to me like it might be a bug on gdb's end -- are you following up with them?
Quoted 2 lines
In the meantime, we don't really need to present these registers to the user for
CONFIG_USER_ONLY.
Reasonable enough, I guess, though a few sysregs are visible to EL0.
thanks
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 5 lines · Richard Henderson
This was working toward fixing
Quoted 7 lines
Quoted 4 lines
although I don't think I'm entirely successful. I would argue, however, that gdb's behaviour in this is odd. Why are registers that are clearly marked "system" being added to "general" simply because they have integer type?
Yeah, this does seem to me like it might be a bug on gdb's end -- are you following up with them?
Yes.
r~