Re: [RFA] print error message if (auto) disassembly failed

Eli Zaretskii
2009-04-17T10:05:32Z

> Date: Fri, 17 Apr 2009 12:23:48 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: tromey@redhat.com, teawater@gmail.com, gdb-patches@sourceware.org
>
> > Date: Thu, 16 Apr 2009 16:59:44 -0700
> > From: Joel Brobecker <brobecker@adacore.com>
> > Cc: gdb-patches@sourceware.org
> >
> > > The default is "auto", which means:
> > >
> > > 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. */
> > >
> > > But I agree with you that this is the wrong default.
> > > I think the default should be "off".
> >
> > Would anyone object to changing the default to "off"?
>
> My vote is to set it to "off", since this is additional functionality
> that evidently not everyone likes.

Btw, the documentation of "auto" is misleading: it makes it sound like
it should _always_ display the disassembly of the next instruction.
But in fact, it only does so when you step over code that doesn't have
line info information or whose source file is unavailable. So how
about the following patch? (If it is accepted, I will fix the manual
as well.)

2009-04-17 Eli Zaretskii <eliz@gnu.org>

* stack.c (_initialize_stack) <disassemble-next-line>: Doc fix.

--- gdb/stack.c~ 2009-04-02 04:05:29.000000000 +0300
+++ gdb/stack.c 2009-04-17 13:00:05.940500000 +0300
@@ -2145,13 +2145,16 @@

add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack,
&disassemble_next_line, _("\
-Set whether to disassemble next source line when execution stops."), _("\
-Show whether to disassemble next source line when execution stops."), _("\
-If ON, GDB will display disassembly of the next source line when\n\
-execution of the program being debugged stops.\n\
-If AUTO (which is the default), or there's no line info to determine\n\
-the source line of the next instruction, display disassembly of next\n\
-instruction instead."),
+Set whether to disassemble next source line or insn when execution stops."), _("\
+Show whether to disassemble next source line or insn when execution stops."), _("\
+If ON, GDB will display disassembly of the next source line, in addition\n\
+to displaying the source line itself. If the next source line cannot\n\
+be displayed (e.g., source is unavailable or there's no line info), GDB\n\
+will display disassembly of next instruction instead of showing the\n\
+source line.\n\
+If AUTO (which is the default), display disassembly of next\n\
+instruction only if the source line cannot be displayed.\n\
+If OFF, never display the disassembly of the next source line."),
NULL,
show_disassemble_next_line,
&setlist, &showlist);