- else
- ui_out_text (uiout, ":\t");
-
- if (filename != NULL)
- xfree (filename);
- if (name != NULL)
- xfree (name);
-
- ui_file_rewind (stb);
- if (flags & DISASSEMBLY_RAW_INSN)
- {
- CORE_ADDR old_pc = pc;
- bfd_byte data;
- int status;
- const char *spacer = "";
-
- /* Build the opcodes using a temporary stream so we can
- write them out in a single go for the MI. */
- struct ui_file *opcode_stream = mem_fileopen ();
- struct cleanup *cleanups =
- make_cleanup_ui_file_delete (opcode_stream);
-
- pc += gdbarch_print_insn (gdbarch, pc, di);
- for (;old_pc < pc; old_pc++)
- {
- status = (*di->read_memory_func) (old_pc, &data, 1, di);
- if (status != 0)
- (*di->memory_error_func) (status, old_pc, di);
- fprintf_filtered (opcode_stream, "%s%02x",
- spacer, (unsigned) data);
- spacer = " ";
- }
- ui_out_field_stream (uiout, "opcodes", opcode_stream);
- ui_out_text (uiout, "\t");
-
- do_cleanups (cleanups);
- }
- else
- pc += gdbarch_print_insn (gdbarch, pc, di);
- ui_out_field_stream (uiout, "inst", stb);
- ui_file_rewind (stb);
- do_cleanups (ui_out_chain);
- ui_out_text (uiout, "\n");
+
+ ui_out_field_stream (uiout, "opcodes", opcode_stream);
+ ui_out_text (uiout, "\t");
+
+ do_cleanups (cleanups);
+ }
+ else
+ size = gdbarch_print_insn (gdbarch, pc, di);
+
+ ui_out_field_stream (uiout, "inst", stb);
+ ui_file_rewind (stb);
+ do_cleanups (ui_out_chain);
+ ui_out_text (uiout, "\n");
+
+ return size;
+}
+
+static int
+dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout,
+ struct disassemble_info * di,
+ CORE_ADDR low, CORE_ADDR high,
+ int how_many, int flags, struct ui_file *stb,
+ CORE_ADDR *end_pc)
+{
+ struct disasm_insn insn;
+ int num_displayed = 0;
+
+ memset (&insn, 0, sizeof (insn));
+ insn.addr = low;
+
+ while (insn.addr < high && (how_many < 0 || num_displayed < how_many))
+ {
+ int size;
+
+ size = gdb_pretty_print_insn (gdbarch, uiout, di, &insn, flags, stb);
+ if (size <= 0)
+ break;
+
+ ++num_displayed;
+ insn.addr += size;
+
+ /* Allow user to bail out with ^C. */
+ QUIT;