diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-05 12:57:55 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-06-06 10:17:04 +0100 |
commit | 47277edc3265cea891d89cef09432c7a537d467a (patch) | |
tree | f98c24388661d59803d6cef31edea1491207e28b | |
parent | 0b4595be3f04aa3741157b24654e554fc3264fc2 (diff) | |
download | gdb-47277edc3265cea891d89cef09432c7a537d467a.zip gdb-47277edc3265cea891d89cef09432c7a537d467a.tar.gz gdb-47277edc3265cea891d89cef09432c7a537d467a.tar.bz2 |
opcodes/riscv: add styling support to print_reg_list
I noticed that some unstyled output had crept into the risc-v
disassembler in this commit:
commit 9132c8152b899a1683bc886f8ba76bedadb48aa1
Date: Tue Feb 27 11:48:11 2024 +0800
RISC-V: Support Zcmp push/pop instructions.
this commit adds styling support. The risc-v disassembler is now once
again, fully styled.
-rw-r--r-- | opcodes/riscv-dis.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 5d135ad..b04a6e7 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -223,26 +223,49 @@ print_reg_list (disassemble_info *info, insn_t l) bool numeric = riscv_gpr_names == riscv_gpr_names_numeric; unsigned reg_list = (int)EXTRACT_OPERAND (REG_LIST, l); unsigned r_start = numeric ? X_S2 : X_S0; - info->fprintf_func (info->stream, "%s", riscv_gpr_names[X_RA]); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_RA]); if (reg_list == 5) - info->fprintf_func (info->stream, ",%s", - riscv_gpr_names[X_S0]); + { + info->fprintf_styled_func (info->stream, dis_style_text, ","); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_S0]); + } else if (reg_list == 6 || (numeric && reg_list > 6)) - info->fprintf_func (info->stream, ",%s-%s", - riscv_gpr_names[X_S0], - riscv_gpr_names[X_S1]); + { + info->fprintf_styled_func (info->stream, dis_style_text, ","); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_S0]); + info->fprintf_styled_func (info->stream, dis_style_text, "-"); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_S1]); + } + if (reg_list == 15) - info->fprintf_func (info->stream, ",%s-%s", - riscv_gpr_names[r_start], - riscv_gpr_names[X_S11]); + { + info->fprintf_styled_func (info->stream, dis_style_text, ","); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[r_start]); + info->fprintf_styled_func (info->stream, dis_style_text, "-"); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_S11]); + } else if (reg_list == 7 && numeric) - info->fprintf_func (info->stream, ",%s", - riscv_gpr_names[X_S2]); + { + info->fprintf_styled_func (info->stream, dis_style_text, ","); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[X_S2]); + } else if (reg_list > 6) - info->fprintf_func (info->stream, ",%s-%s", - riscv_gpr_names[r_start], - riscv_gpr_names[reg_list + 11]); + { + info->fprintf_styled_func (info->stream, dis_style_text, ","); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[r_start]); + info->fprintf_styled_func (info->stream, dis_style_text, "-"); + info->fprintf_styled_func (info->stream, dis_style_register, + "%s", riscv_gpr_names[reg_list + 11]); + } } /* Get Zcmp sp adjustment immediate. */ |