From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2138) id CD9C13858C2F; Mon, 20 Feb 2023 18:40:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD9C13858C2F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andreas Schwab To: bfd-cvs@sourceware.org Subject: [binutils-gdb] opcodes: style m68k disassembler output X-Act-Checkin: binutils-gdb X-Git-Author: Andreas Schwab X-Git-Refname: refs/heads/master X-Git-Oldrev: 19005d19891221e878f3b2e91134a439ad78235f X-Git-Newrev: c22ff449275c91e4842bb10c650e83c572580f65 Message-Id: <20230220184007.CD9C13858C2F@sourceware.org> Date: Mon, 20 Feb 2023 18:40:07 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2023 18:40:07 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc22ff449275c= 91e4842bb10c650e83c572580f65 commit c22ff449275c91e4842bb10c650e83c572580f65 Author: Andreas Schwab Date: Tue Feb 14 18:07:19 2023 +0100 opcodes: style m68k disassembler output Diff: --- opcodes/m68k-dis.c | 354 +++++++++++++++++++++++++++++++++++--------------= ---- 1 file changed, 238 insertions(+), 116 deletions(-) diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index a416fbe7cfa..fb384640763 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -213,7 +213,8 @@ fetch_data (struct disassemble_info *info, bfd_byte *ad= dr) =0C /* This function is used to print to the bit-bucket. */ static int -dummy_printer (FILE *file ATTRIBUTE_UNUSED, +dummy_printer (void *file ATTRIBUTE_UNUSED, + enum disassembler_style style ATTRIBUTE_UNUSED, const char *format ATTRIBUTE_UNUSED, ...) { @@ -510,18 +511,39 @@ print_base (int regno, bfd_vma disp, disassemble_info= *info) { if (regno =3D=3D -1) { - (*info->fprintf_func) (info->stream, "%%pc@("); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%p= c"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); (*info->print_address_func) (disp, info); } else { - if (regno =3D=3D -2) - (*info->fprintf_func) (info->stream, "@("); - else if (regno =3D=3D -3) - (*info->fprintf_func) (info->stream, "%%zpc@("); - else - (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]); - (*info->fprintf_func) (info->stream, "%" PRIx64, (uint64_t) disp); + if (regno =3D=3D -3) + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%zpc"); + else if (regno !=3D -2) + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[regno]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "%" PRIx64, (uint64_t) disp); + } +} + +/* Print the index register of an indexed argument, as encoded in the + extension word. */ + +static void +print_index_register (int ext, disassemble_info *info) +{ + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[(ext >> 12) & 0xf]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + ":%c", ext & 0x800 ? 'l' : 'w'); + if ((ext >> 9) & 3) + { + (*info->fprintf_styled_func) (info->stream, dis_style_text, ":"); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "%d", 1 << ((ext >> 9) & 3)); } } =20 @@ -537,20 +559,12 @@ print_indexed (int basereg, disassemble_info *info) { int word; - static char *const scales[] =3D { "", ":2", ":4", ":8" }; bfd_vma base_disp; bfd_vma outer_disp; - char buf[40]; + bool print_index =3D true; =20 NEXTWORD (p, word, NULL); =20 - /* Generate the text for the index register. - Where this will be output is not yet determined. */ - sprintf (buf, "%s:%c%s", - reg_names[(word >> 12) & 0xf], - (word & 0x800) ? 'l' : 'w', - scales[(word >> 9) & 3]); - /* Handle the 68000 style of indexing. */ =20 if ((word & 0x100) =3D=3D 0) @@ -561,7 +575,9 @@ print_indexed (int basereg, if (basereg =3D=3D -1) base_disp +=3D addr; print_base (basereg, base_disp, info); - (*info->fprintf_func) (info->stream, ",%s)", buf); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ","); + print_index_register (word, info); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); return p; } =20 @@ -575,7 +591,7 @@ print_indexed (int basereg, basereg =3D -2; } if (word & 0100) - buf[0] =3D '\0'; + print_index =3D false; base_disp =3D 0; switch ((word >> 4) & 3) { @@ -592,9 +608,12 @@ print_indexed (int basereg, if ((word & 7) =3D=3D 0) { print_base (basereg, base_disp, info); - if (buf[0] !=3D '\0') - (*info->fprintf_func) (info->stream, ",%s", buf); - (*info->fprintf_func) (info->stream, ")"); + if (print_index) + { + (*info->fprintf_styled_func) (info->stream, dis_style_text, ","); + print_index_register (word, info); + } + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); return p; } =20 @@ -610,15 +629,22 @@ print_indexed (int basereg, } =20 print_base (basereg, base_disp, info); - if ((word & 4) =3D=3D 0 && buf[0] !=3D '\0') + if ((word & 4) =3D=3D 0 && print_index) { - (*info->fprintf_func) (info->stream, ",%s", buf); - buf[0] =3D '\0'; + (*info->fprintf_styled_func) (info->stream, dis_style_text, ","); + print_index_register (word, info); + print_index =3D false; } - (*info->fprintf_func) (info->stream, ")@(%" PRIx64, (uint64_t) outer_dis= p); - if (buf[0] !=3D '\0') - (*info->fprintf_func) (info->stream, ",%s", buf); - (*info->fprintf_func) (info->stream, ")"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + ")@("); + (*info->fprintf_styled_func) (info->stream, dis_style_address_offset, + "%" PRIx64, (uint64_t) outer_disp); + if (print_index) + { + (*info->fprintf_styled_func) (info->stream, dis_style_text, ","); + print_index_register (word, info); + } + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); =20 return p; } @@ -660,14 +686,17 @@ print_insn_arg (const char *d, { static char *const cacheFieldName[] =3D { "nc", "dc", "ic", "bc" }; FETCH_ARG (2, val); - (*info->fprintf_func) (info->stream, "%s", cacheFieldName[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_sub_mnemonic, + "%s", cacheFieldName[val]); break; } =20 case 'a': /* Address register indirect only. Cf. case '+'. */ { FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s@", reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%s", + reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@"); break; } =20 @@ -679,27 +708,27 @@ print_insn_arg (const char *d, } =20 case 'C': - (*info->fprintf_func) (info->stream, "%%ccr"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%c= cr"); break; =20 case 'S': - (*info->fprintf_func) (info->stream, "%%sr"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%s= r"); break; =20 case 'U': - (*info->fprintf_func) (info->stream, "%%usp"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%u= sp"); break; =20 case 'E': - (*info->fprintf_func) (info->stream, "%%acc"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%a= cc"); break; =20 case 'G': - (*info->fprintf_func) (info->stream, "%%macsr"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%m= acsr"); break; =20 case 'H': - (*info->fprintf_func) (info->stream, "%%mask"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%m= ask"); break; =20 case 'J': @@ -749,7 +778,8 @@ print_insn_arg (const char *d, for (regno =3D ARRAY_SIZE (names_v4e); --regno >=3D 0;) if (names_v4e[regno].value =3D=3D val) { - (*info->fprintf_func) (info->stream, "%s", names_v4e[regno].name); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", names_v4e[regno].name); break; } if (regno >=3D 0) @@ -758,11 +788,12 @@ print_insn_arg (const char *d, for (regno =3D ARRAY_SIZE (names) - 1; regno >=3D 0; regno--) if (names[regno].value =3D=3D val) { - (*info->fprintf_func) (info->stream, "%s", names[regno].name); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", names[regno].name); break; } if (regno < 0) - (*info->fprintf_func) (info->stream, "0x%x", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "0x%x", val= ); } break; =20 @@ -771,7 +802,8 @@ print_insn_arg (const char *d, /* 0 means 8, except for the bkpt instruction... */ if (val =3D=3D 0 && d[1] !=3D 's') val =3D 8; - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 case 'x': @@ -779,17 +811,20 @@ print_insn_arg (const char *d, /* 0 means -1. */ if (val =3D=3D 0) val =3D -1; - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 case 'j': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "#%d", val+1); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val+1); break; =20 case 'K': FETCH_ARG (9, val); - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 case 'M': @@ -798,80 +833,108 @@ print_insn_arg (const char *d, static char *const scalefactor_name[] =3D { "<<", ">>" }; =20 FETCH_ARG (1, val); - (*info->fprintf_func) (info->stream, "%s", scalefactor_name[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_sub_mnemonic, + "%s", scalefactor_name[val]); } else { FETCH_ARG (8, val); if (val & 0x80) val =3D val - 0x100; - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); } break; =20 case 'T': FETCH_ARG (4, val); - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 case 'D': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s", reg_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val]); break; =20 case 'A': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s", reg_names[val + 010]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val + 010]); break; =20 case 'R': FETCH_ARG (4, val); - (*info->fprintf_func) (info->stream, "%s", reg_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val]); break; =20 case 'r': FETCH_ARG (4, regno); if (regno > 7) - (*info->fprintf_func) (info->stream, "%s@", reg_names[regno]); + { + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[regno]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@"); + } else - (*info->fprintf_func) (info->stream, "@(%s)", reg_names[regno]); + { + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[regno]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); + } break; =20 case 'F': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%%fp%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%fp%d", val); break; =20 case 'O': FETCH_ARG (6, val); if (val & 0x20) - (*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val & 7]); else - (*info->fprintf_func) (info->stream, "%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "%d", val); break; =20 case '+': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s@+", reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@+"); break; =20 case '-': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s@-", reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@-"); break; =20 case 'k': if (place =3D=3D 'k') { FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "{%s}", reg_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "{"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "}"); } else if (place =3D=3D 'C') { FETCH_ARG (7, val); if (val > 63) /* This is a signed constant. */ val -=3D 128; - (*info->fprintf_func) (info->stream, "{#%d}", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "{"); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "}"); } else return PRINT_INSN_ARG_INVALID_OPERAND; @@ -897,7 +960,8 @@ print_insn_arg (const char *d, else return PRINT_INSN_ARG_INVALID_OP_TABLE; =20 - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 case 'B': @@ -936,31 +1000,41 @@ print_insn_arg (const char *d, =20 NEXTWORD (p, val, PRINT_INSN_ARG_MEMORY_ERROR); FETCH_ARG (3, val1); - (*info->fprintf_func) (info->stream, "%s@(%d)", reg_names[val1 + 8], val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val1 + 8]); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); + (*info->fprintf_styled_func) (info->stream, dis_style_address_offset, + "%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); break; } =20 case 's': FETCH_ARG (3, val); - (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", fpcr_names[val]); break; =20 case 'e': FETCH_ARG (2, val); - (*info->fprintf_func) (info->stream, "%%acc%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%acc%d", val); break; =20 case 'g': FETCH_ARG (1, val); - (*info->fprintf_func) (info->stream, "%%accext%s", val =3D=3D 0 ? "0= 1" : "23"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%accext%s", val =3D=3D 0 ? "01" : "23"); break; =20 case 'i': FETCH_ARG (2, val); if (val =3D=3D 1) - (*info->fprintf_func) (info->stream, "<<"); + (*info->fprintf_styled_func) (info->stream, dis_style_sub_mnemonic, + "<<"); else if (val =3D=3D 3) - (*info->fprintf_func) (info->stream, ">>"); + (*info->fprintf_styled_func) (info->stream, dis_style_sub_mnemonic, + ">>"); else return PRINT_INSN_ARG_INVALID_OPERAND; break; @@ -971,7 +1045,8 @@ print_insn_arg (const char *d, if (val < 0) return PRINT_INSN_ARG_MEMORY_ERROR; if (val !=3D 1) /* Unusual coprocessor ID? */ - (*info->fprintf_func) (info->stream, "(cpid=3D%d) ", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + "(cpid=3D%d) ", val); break; =20 case '4': @@ -1022,28 +1097,41 @@ print_insn_arg (const char *d, switch (val >> 3) { case 0: - (*info->fprintf_func) (info->stream, "%s", reg_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[val]); break; =20 case 1: - (*info->fprintf_func) (info->stream, "%s", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", regname); break; =20 case 2: - (*info->fprintf_func) (info->stream, "%s@", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@"); break; =20 case 3: - (*info->fprintf_func) (info->stream, "%s@+", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@+"); break; =20 case 4: - (*info->fprintf_func) (info->stream, "%s@-", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@-"); break; =20 case 5: NEXTWORD (p, val, PRINT_INSN_ARG_MEMORY_ERROR); - (*info->fprintf_func) (info->stream, "%s@(%d)", regname, val); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", regname); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); + (*info->fprintf_styled_func) (info->stream, dis_style_address_offset, + "%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); break; =20 case 6: @@ -1067,9 +1155,11 @@ print_insn_arg (const char *d, =20 case 2: NEXTWORD (p, val, PRINT_INSN_ARG_MEMORY_ERROR); - (*info->fprintf_func) (info->stream, "%%pc@("); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%pc"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, "@("); (*info->print_address_func) (addr + val, info); - (*info->fprintf_func) (info->stream, ")"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, ")"); break; =20 case 3: @@ -1117,9 +1207,11 @@ print_insn_arg (const char *d, return PRINT_INSN_ARG_INVALID_OPERAND; } if (flt_p) /* Print a float? */ - (*info->fprintf_func) (info->stream, "#0e%g", flval); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#0e%g", flval); else - (*info->fprintf_func) (info->stream, "#%d", val); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#%d", val); break; =20 default: @@ -1134,7 +1226,7 @@ print_insn_arg (const char *d, { FETCH_ARG (1, val); if (val) - info->fprintf_func (info->stream, "&"); + info->fprintf_styled_func (info->stream, dis_style_text, "&"); } break; =20 @@ -1150,7 +1242,8 @@ print_insn_arg (const char *d, p =3D p1 > p ? p1 : p; if (val =3D=3D 0) { - (*info->fprintf_func) (info->stream, "#0"); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#0"); break; } if (*d =3D=3D 'l') @@ -1170,15 +1263,22 @@ print_insn_arg (const char *d, int first_regno; =20 if (doneany) - (*info->fprintf_func) (info->stream, "/"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + "/"); doneany =3D 1; - (*info->fprintf_func) (info->stream, "%s", reg_names[regno]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", reg_names[regno]); first_regno =3D regno; while (val & (1 << (regno + 1))) ++regno; if (regno > first_regno) - (*info->fprintf_func) (info->stream, "-%s", - reg_names[regno]); + { + (*info->fprintf_styled_func) (info->stream, + dis_style_text, "-"); + (*info->fprintf_styled_func) (info->stream, + dis_style_register, "%s", + reg_names[regno]); + } } } else if (place =3D=3D '3') @@ -1189,7 +1289,8 @@ print_insn_arg (const char *d, FETCH_ARG (8, val); if (val =3D=3D 0) { - (*info->fprintf_func) (info->stream, "#0"); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "#0"); break; } if (*d =3D=3D 'l') @@ -1208,21 +1309,30 @@ print_insn_arg (const char *d, { int first_regno; if (doneany) - (*info->fprintf_func) (info->stream, "/"); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + "/"); doneany =3D 1; - (*info->fprintf_func) (info->stream, "%%fp%d", regno); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%fp%d", regno); first_regno =3D regno; while (val & (1 << (regno + 1))) ++regno; if (regno > first_regno) - (*info->fprintf_func) (info->stream, "-%%fp%d", regno); + { + (*info->fprintf_styled_func) (info->stream, + dis_style_text, "-"); + (*info->fprintf_styled_func) (info->stream, + dis_style_register, + "%%fp%d", regno); + } } } else if (place =3D=3D '8') { FETCH_ARG (3, val); /* fmoveml for FP status registers. */ - (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", fpcr_names[val]); } else return PRINT_INSN_ARG_INVALID_OP_TABLE; @@ -1261,16 +1371,18 @@ print_insn_arg (const char *d, { int break_reg =3D ((buffer[3] >> 2) & 7); =20 - (*info->fprintf_func) - (info->stream, val =3D=3D 0x1c ? "%%bad%d" : "%%bac%d", - break_reg); + (*info->fprintf_styled_func) + (info->stream, dis_style_register, + val =3D=3D 0x1c ? "%%bad%d" : "%%bac%d", break_reg); } break; default: - (*info->fprintf_func) (info->stream, "", val); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + "", val); } if (name) - (*info->fprintf_func) (info->stream, "%s", name); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%s", name); } break; =20 @@ -1280,17 +1392,20 @@ print_insn_arg (const char *d, =20 FETCH_ARG (5, fc); if (fc =3D=3D 1) - (*info->fprintf_func) (info->stream, "%%dfc"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%dfc"); else if (fc =3D=3D 0) - (*info->fprintf_func) (info->stream, "%%sfc"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, + "%%sfc"); else /* xgettext:c-format */ - (*info->fprintf_func) (info->stream, _(""), fc); + (*info->fprintf_styled_func) (info->stream, dis_style_text, + _(""), fc); } break; =20 case 'V': - (*info->fprintf_func) (info->stream, "%%val"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%%v= al"); break; =20 case 't': @@ -1298,7 +1413,8 @@ print_insn_arg (const char *d, int level; =20 FETCH_ARG (3, level); - (*info->fprintf_func) (info->stream, "%d", level); + (*info->fprintf_styled_func) (info->stream, dis_style_immediate, + "%d", level); } break; =20 @@ -1313,9 +1429,9 @@ print_insn_arg (const char *d, is_upper =3D 1; reg &=3D 0xf; } - (*info->fprintf_func) (info->stream, "%s%s", - reg_half_names[reg], - is_upper ? "u" : "l"); + (*info->fprintf_styled_func) (info->stream, dis_style_register, "%s%s", + reg_half_names[reg], + is_upper ? "u" : "l"); } break; =20 @@ -1342,7 +1458,7 @@ match_insn_m68k (bfd_vma memaddr, =20 struct private *priv =3D (struct private *) info->private_data; bfd_byte *buffer =3D priv->the_buffer; - fprintf_ftype save_printer =3D info->fprintf_func; + fprintf_styled_ftype save_printer =3D info->fprintf_styled_func; void (* save_print_address) (bfd_vma, struct disassemble_info *) =3D info->print_address_func; =20 @@ -1423,7 +1539,7 @@ match_insn_m68k (bfd_vma memaddr, =20 save_p =3D p; info->print_address_func =3D dummy_print_address; - info->fprintf_func =3D (fprintf_ftype) dummy_printer; + info->fprintf_styled_func =3D dummy_printer; =20 /* We scan the operands twice. The first time we don't print anything, but look for errors. */ @@ -1436,7 +1552,7 @@ match_insn_m68k (bfd_vma memaddr, else if (eaten =3D=3D PRINT_INSN_ARG_INVALID_OPERAND || eaten =3D=3D PRINT_INSN_ARG_MEMORY_ERROR) { - info->fprintf_func =3D save_printer; + info->fprintf_styled_func =3D save_printer; info->print_address_func =3D save_print_address; return eaten =3D=3D PRINT_INSN_ARG_MEMORY_ERROR ? -1 : 0; } @@ -1444,26 +1560,26 @@ match_insn_m68k (bfd_vma memaddr, { /* We must restore the print functions before trying to print the error message. */ - info->fprintf_func =3D save_printer; + info->fprintf_styled_func =3D save_printer; info->print_address_func =3D save_print_address; - info->fprintf_func (info->stream, - /* xgettext:c-format */ - _("\n"), - best->name, best->args); + info->fprintf_styled_func (info->stream, dis_style_text, + /* xgettext:c-format */ + _("\n"), + best->name, best->args); return 2; } } =20 p =3D save_p; - info->fprintf_func =3D save_printer; + info->fprintf_styled_func =3D save_printer; info->print_address_func =3D save_print_address; =20 d =3D args; =20 - info->fprintf_func (info->stream, "%s", best->name); + info->fprintf_styled_func (info->stream, dis_style_mnemonic, "%s", best-= >name); =20 if (*d) - info->fprintf_func (info->stream, " "); + info->fprintf_styled_func (info->stream, dis_style_text, " "); =20 while (*d) { @@ -1471,7 +1587,7 @@ match_insn_m68k (bfd_vma memaddr, d +=3D 2; =20 if (*d && *(d - 2) !=3D 'I' && *d !=3D 'k') - info->fprintf_func (info->stream, ","); + info->fprintf_styled_func (info->stream, dis_style_text, ","); } =20 return p - buffer; @@ -1638,8 +1754,14 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *= info) } =20 if (val =3D=3D 0) - /* Handle undefined instructions. */ - info->fprintf_func (info->stream, ".short 0x%04x", (buffer[0] << 8) + = buffer[1]); + { + /* Handle undefined instructions. */ + info->fprintf_styled_func (info->stream, dis_style_assembler_directi= ve, + ".short"); + info->fprintf_styled_func (info->stream, dis_style_text, " "); + info->fprintf_styled_func (info->stream, dis_style_immediate, + "0x%04x", (buffer[0] << 8) + buffer[1]); + } =20 return val ? val : 2; }