diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-10-13 18:18:12 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-10-22 13:42:37 +0100 |
commit | 431be556b0bdd0733dedec2368d8d6a72cacea72 (patch) | |
tree | 830c93f1f139e82ca3b830cbb8f7f001aa229a31 /gdb/disasm.c | |
parent | c628f812eba820e11ef83033b38becca1b148dc5 (diff) | |
download | gdb-431be556b0bdd0733dedec2368d8d6a72cacea72.zip gdb-431be556b0bdd0733dedec2368d8d6a72cacea72.tar.gz gdb-431be556b0bdd0733dedec2368d8d6a72cacea72.tar.bz2 |
gdb: make disassembler fprintf callback a static member function
The disassemble_info structure has four callbacks, we have three of
them as static member functions within gdb_disassembler, the fourth is
just a global static function.
However, this fourth callback, is still only used from the
disassemble_info struct, so there's no real reason for its special
handling.
This commit makes fprintf_disasm a static method within
gdb_disassembler.
There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r-- | gdb/disasm.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c index dc64267..c045dfc 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -163,6 +163,20 @@ gdb_disassembler::dis_asm_print_address (bfd_vma addr, print_address (self->arch (), addr, self->stream ()); } +/* Format disassembler output to STREAM. */ + +int +gdb_disassembler::dis_asm_fprintf (void *stream, const char *format, ...) +{ + va_list args; + + va_start (args, format); + vfprintf_filtered ((struct ui_file *) stream, format, args); + va_end (args); + /* Something non -ve. */ + return 0; +} + static bool line_is_less_than (const deprecated_dis_line_entry &mle1, const deprecated_dis_line_entry &mle2) @@ -711,21 +725,6 @@ do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, dump_insns (gdbarch, uiout, low, high, how_many, flags, NULL); } -/* Initialize the disassemble info struct ready for the specified - stream. */ - -static int ATTRIBUTE_PRINTF (2, 3) -fprintf_disasm (void *stream, const char *format, ...) -{ - va_list args; - - va_start (args, format); - vfprintf_filtered ((struct ui_file *) stream, format, args); - va_end (args); - /* Something non -ve. */ - return 0; -} - /* Combine implicit and user disassembler options and return them in a newly-created string. */ @@ -756,7 +755,7 @@ gdb_disassembler::gdb_disassembler (struct gdbarch *gdbarch, di_read_memory_ftype read_memory_func) : m_gdbarch (gdbarch) { - init_disassemble_info (&m_di, file, fprintf_disasm); + init_disassemble_info (&m_di, file, dis_asm_fprintf); m_di.flavour = bfd_target_unknown_flavour; m_di.memory_error_func = dis_asm_memory_error; m_di.print_address_func = dis_asm_print_address; |