diff options
author | Joseph Faulls <Joseph.Faulls@imgtec.com> | 2023-09-27 12:42:55 +0000 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2023-10-13 09:00:52 +0800 |
commit | 9326300e4d3dbe943380b30766ed474d98df07ba (patch) | |
tree | ab31d97e9728342e10eeec2d301564e9d1fee04f /opcodes/riscv-dis.c | |
parent | 5772d798236d493a0cdfd75b41520527e3129759 (diff) | |
download | gdb-9326300e4d3dbe943380b30766ed474d98df07ba.zip gdb-9326300e4d3dbe943380b30766ed474d98df07ba.tar.gz gdb-9326300e4d3dbe943380b30766ed474d98df07ba.tar.bz2 |
RISC-V: Add support for numbered ISA mapping strings
The elf psabi allows for mapping symbols to be of the form $x<ISA>.<any>
opcodes/
* riscv-dis.c (riscv_get_map_state): allow mapping symbol to
be suffixed by a unique identifier .<any>
Diffstat (limited to 'opcodes/riscv-dis.c')
-rw-r--r-- | opcodes/riscv-dis.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index c0fd062..216916e 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -869,7 +869,21 @@ riscv_get_map_state (int n, { *state = MAP_INSN; riscv_release_subset_list (&riscv_subsets); - riscv_parse_subset (&riscv_rps_dis, name + 2); + + /* ISA mapping string may be numbered, suffixed with '.n'. Do not + consider this as part of the ISA string. */ + char *suffix = strchr (name, '.'); + if (suffix) + { + int suffix_index = (int)(suffix - name); + char *name_substr = xmalloc (suffix_index + 1); + strncpy (name_substr, name, suffix_index); + name_substr[suffix_index] = '\0'; + riscv_parse_subset (&riscv_rps_dis, name_substr + 2); + free (name_substr); + } + else + riscv_parse_subset (&riscv_rps_dis, name + 2); } else return false; |