+/* 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 (stream, format, args);
+ va_end (args);
+ /* Something non -ve. */
+ return 0;
+}
+
+static struct disassemble_info
+gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
+{
+ struct disassemble_info di;
+
+ init_disassemble_info (&di, file, fprintf_disasm);
+ di.flavour = bfd_target_unknown_flavour;
+ di.memory_error_func = dis_asm_memory_error;
+ di.print_address_func = dis_asm_print_address;
+ /* NOTE: cagney/2003-04-28: The original code, from the old Insight
+ disassembler had a local optomization here. By default it would
+ access the executable file, instead of the target memory (there
+ was a growing list of exceptions though). Unfortunately, the
+ heuristic was flawed. Commands like "disassemble &variable"
+ didn't work as they relied on the access going to the target.
+ Further, it has been supperseeded by trust-read-only-sections
+ (although that should be superseeded by target_trust..._p()). */
+ di.read_memory_func = dis_asm_read_memory;
+ di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
+ di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
+ di.endian = gdbarch_byte_order (gdbarch);
+ di.endian_code = gdbarch_byte_order_for_code (gdbarch);
+ di.application_data = gdbarch;
+ disassemble_init_for_target (&di);
+ return di;
+}
+