[commit/ob] Fix "show inferior-tty" output

Daniel Jacobowitz dan@codesourcery.com
Tue Feb 16 21:18:00 GMT 2010


GDB 7.0:

(gdb) show inferior-tty
Terminal for future runs of program being debugged is "".

GDB trunk:

(gdb) show inferior-tty
argument list to give program being debugged when it is started is (null)(gdb)

Passing the NULL to printf crashes on Windows, and gives useless
output on Linux.  Also missing newline, and completely different text.

I've tested this patch on arm-none-eabi and x86_64-linux, and checked
it in.  On Windows hosts, this fixes dozens of timeouts in default.exp
after GDB crashes.

-- 
Daniel Jacobowitz
CodeSourcery

2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>

	gdb/
	* infcmd.c (show_inferior_tty_command): Check for NULL.
	Correct output message.

diff -urp gdb-merged-orig/gdb/infcmd.c gdb-merged/gdb/infcmd.c
--- gdb-merged-orig/gdb/infcmd.c	2010-02-11 12:53:27.000000000 -0800
+++ gdb-merged/gdb/infcmd.c	2010-02-14 09:35:17.000000000 -0800
@@ -197,10 +197,12 @@ show_inferior_tty_command (struct ui_fil
 {
   /* Note that we ignore the passed-in value in favor of computing it
      directly.  */
+  const char *inferior_io_terminal = get_inferior_io_terminal ();
+  if (inferior_io_terminal == NULL)
+    inferior_io_terminal = "";
   fprintf_filtered (gdb_stdout,
-		    _("argument list to give program being debugged when "
-		      "it is started is %s"),
-		    get_inferior_io_terminal ());
+		    _("Terminal for future runs of program being debugged "
+		      "is \"%s\".\n"), inferior_io_terminal);
 }
 
 char *



More information about the Gdb-patches mailing list