Skip to content

Commit c380b7c

Browse files
authored
Merge pull request #1221 from aap-sc/aap-sc/expose_csr_fixup
fix expose_csr for CSR with address "0"
2 parents b6ade1b + 3999025 commit c380b7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/target/riscv/riscv_reg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static const char * const default_reg_names[GDB_REGNO_COUNT] = {
5656
[GDB_REGNO_T5] = "t5",
5757
[GDB_REGNO_T6] = "t6",
5858
[GDB_REGNO_PC] = "pc",
59-
[GDB_REGNO_CSR0] = "csr0",
6059
[GDB_REGNO_PRIV] = "priv",
6160
[GDB_REGNO_FT0] = "ft0",
6261
[GDB_REGNO_FT1] = "ft1",
@@ -196,7 +195,8 @@ const char *riscv_reg_gdb_regno_name(const struct target *target, enum gdb_regno
196195
}
197196
if (regno >= GDB_REGNO_CSR0 && regno <= GDB_REGNO_CSR4095) {
198197
init_custom_csr_names(target);
199-
info->reg_names[regno] = init_reg_name_with_prefix("csr", regno - GDB_REGNO_CSR0);
198+
if (!info->reg_names[regno])
199+
info->reg_names[regno] = init_reg_name_with_prefix("csr", regno - GDB_REGNO_CSR0);
200200
return info->reg_names[regno];
201201
}
202202
assert(!"Encountered uninitialized entry in reg_names table");

0 commit comments

Comments
 (0)