+class gdb_disassembler
+{
+ using di_read_memory_ftype = decltype (disassemble_info::read_memory_func);
+
+public:
+ gdb_disassembler (struct gdbarch *gdbarch, struct ui_file *file)
+ : gdb_disassembler (gdbarch, file, dis_asm_read_memory)
+ {}
+
+ ~gdb_disassembler ();
+
+ DISABLE_COPY_AND_ASSIGN (gdb_disassembler);
+
+ int print_insn (CORE_ADDR memaddr, int *branch_delay_insns = NULL);
+
+ /* Return the gdbarch of gdb_disassembler. */
+ struct gdbarch *arch ()
+ { return m_gdbarch; }
+
+protected:
+ gdb_disassembler (struct gdbarch *gdbarch, struct ui_file *file,
+ di_read_memory_ftype func);
+
+ struct ui_file *stream ()
+ { return (struct ui_file *) m_di.stream; }
+
+private:
+ struct gdbarch *m_gdbarch;
+
+ /* Stores data required for disassembling instructions in
+ opcodes. */
+ struct disassemble_info m_di;
+
+ /* If we own the string in `m_di.disassembler_options', we do so
+ using this field. */
+ std::string m_disassembler_options_holder;
+
+ CORE_ADDR m_err_memaddr;
+
+ static int dis_asm_read_memory (bfd_vma memaddr, gdb_byte *myaddr,
+ unsigned int len,
+ struct disassemble_info *info);
+ static void dis_asm_memory_error (int err, bfd_vma memaddr,
+ struct disassemble_info *info);
+ static void dis_asm_print_address (bfd_vma addr,
+ struct disassemble_info *info);
+};
+
+/* An instruction to be disassembled. */
+
+struct disasm_insn
+{
+ /* The address of the memory containing the instruction. */
+ CORE_ADDR addr;
+
+ /* An optional instruction number. If non-zero, it is printed first. */
+ unsigned int number;
+
+ /* True if the instruction was executed speculatively. */
+ unsigned int is_speculative:1;
+};
+