-/* Print information about a frame for frame "fi" at level "level".
- Used in "where" output, also used to emit breakpoint or step
- messages.
- LEVEL is the level of the frame, or -1 if it is the
- innermost frame but we don't want to print the level.
- The meaning of the SOURCE argument is:
- SRC_LINE: Print only source line
- LOCATION: Print only location
- LOC_AND_SRC: Print location and source line. */
+/* If ON, GDB will display disassembly of the next source line when
+ execution of the program being debugged stops.
+ If AUTO (which is the default), or there's no line info to determine
+ the source line of the next instruction, display disassembly of next
+ instruction instead. */
+
+static enum auto_boolean disassemble_next_line;
+
+static void
+show_disassemble_next_line (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("\
+Debugger's willingness to use disassemble-next-line is %s.\n"),
+ value);
+}
+
+/* Show assembly codes; stub for catch_errors. */
+
+struct gdb_disassembly_stub_args
+{
+ struct gdbarch *gdbarch;
+ int how_many;
+ CORE_ADDR low;
+ CORE_ADDR high;
+};
+
+static void
+gdb_disassembly_stub (void *args)
+{
+ struct gdb_disassembly_stub_args *p = args;
+ gdb_disassembly (p->gdbarch, uiout, 0,
+ DISASSEMBLY_RAW_INSN, p->how_many,
+ p->low, p->high);
+}
+
+/* Use TRY_CATCH to catch the exception from the gdb_disassembly
+ because it will be broken by filter sometime. */
+
+static void
+do_gdb_disassembly (struct gdbarch *gdbarch,
+ int how_many, CORE_ADDR low, CORE_ADDR high)
+{
+ volatile struct gdb_exception exception;
+ struct gdb_disassembly_stub_args args;
+
+ args.gdbarch = gdbarch;
+ args.how_many = how_many;
+ args.low = low;
+ args.high = high;
+ TRY_CATCH (exception, RETURN_MASK_ALL)
+ {
+ gdb_disassembly_stub (&args);
+ }
+ /* If an exception was thrown while doing the disassembly, print
+ the error message, to give the user a clue of what happened. */
+ if (exception.reason == RETURN_ERROR)
+ exception_print (gdb_stderr, exception);
+}
+
+/* Print information about frame FRAME. The output is format according
+ to PRINT_LEVEL and PRINT_WHAT and PRINT ARGS. The meaning of
+ PRINT_WHAT is:
+
+ SRC_LINE: Print only source line.
+ LOCATION: Print only location.
+ LOC_AND_SRC: Print location and source line.
+
+ Used in "where" output, and to emit breakpoint or step
+ messages. */