return false;
}
-/* Copy of gdb_buffered_insn_length_fprintf from disasm.c. */
-
-static int ATTRIBUTE_PRINTF (2, 3)
-arc_fprintf_disasm (void *stream, const char *format, ...)
-{
- return 0;
-}
+/* See arc-tdep.h. */
struct disassemble_info
arc_disassemble_info (struct gdbarch *gdbarch)
{
struct disassemble_info di;
- init_disassemble_info (&di, &null_stream, arc_fprintf_disasm);
+ init_disassemble_info_for_no_printing (&di);
di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
di.endian = gdbarch_byte_order (gdbarch);
return gdb_print_insn (gdbarch, addr, &null_stream, NULL);
}
-/* fprintf-function for gdb_buffered_insn_length. This function is a
- nop, we don't want to print anything, we just want to compute the
- length of the insn. */
+/* An fprintf-function for use by the disassembler when we know we don't
+ want to print anything. Always returns success. */
static int ATTRIBUTE_PRINTF (2, 3)
-gdb_buffered_insn_length_fprintf (void *stream, const char *format, ...)
+gdb_disasm_null_printf (void *stream, const char *format, ...)
{
return 0;
}
+/* See disasm.h. */
+
+void
+init_disassemble_info_for_no_printing (struct disassemble_info *dinfo)
+{
+ init_disassemble_info (dinfo, nullptr, gdb_disasm_null_printf);
+}
+
/* Initialize a struct disassemble_info for gdb_buffered_insn_length.
Upon return, *DISASSEMBLER_OPTIONS_HOLDER owns the string pointed
to by DI.DISASSEMBLER_OPTIONS. */
CORE_ADDR addr,
std::string *disassembler_options_holder)
{
- init_disassemble_info (di, NULL, gdb_buffered_insn_length_fprintf);
+ init_disassemble_info_for_no_printing (di);
/* init_disassemble_info installs buffer_read_memory, etc.
so we don't need to do that here.
extern void set_disassembler_options (const char *options);
+/* Setup DINFO with its output function and output stream setup so that
+ nothing is printed while disassembling. */
+
+extern void init_disassemble_info_for_no_printing
+ (struct disassemble_info *dinfo);
+
#endif
/* Support functions for frame handling. */
-/* Copy of gdb_buffered_insn_length_fprintf from disasm.c. */
-static int ATTRIBUTE_PRINTF (2, 3)
-s12z_fprintf_disasm (void *stream, const char *format, ...)
-{
- return 0;
-}
+/* Return a disassemble_info initialized for s12z disassembly, however,
+ the disassembler will not actually print anything. */
static struct disassemble_info
s12z_disassemble_info (struct gdbarch *gdbarch)
{
struct disassemble_info di;
- init_disassemble_info (&di, &null_stream, s12z_fprintf_disasm);
+ init_disassemble_info_for_no_printing (&di);
di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
di.endian = gdbarch_byte_order (gdbarch);