Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] print newline after copyright message
@ 2006-07-19 20:35 Bob Wilson
  2006-07-24 20:18 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Bob Wilson @ 2006-07-19 20:35 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 3188 bytes --]

Maybe I'm missing something here, but the way that GDB currently
separates its copyright message from subsequent messages seems broken.
The copyright message is printed without a newline at the end.  Then,
after handling .gdbinit, attaching to the exec file and loading the
symbol file, the newline is finally printed.  (But, for some reason,
the newline comes before loading a core file.)  During the interval
between printing the copyright message and the subsequent newline,
some attempt has been made to set error_pre_print, etc. to add a blank
line between the copyright and any error/warning messages.

Presumably there was a good reason for doing it this way, but if that
reason still holds, I can't figure out what it is.

I've found some problems with this scheme:

*) Warnings are handled differently than errors, with no blank line to
separate them from the copyright message.  This makes them less
visible, since people often get used to ignoring the copyright message.
According to a comment in the code, since there may be multiple
warnings, adding double newlines to warning_pre_print is not good
because then they would all be double-spaced.  This comment is not
quite right, though....

*) Because warnings already end with newlines, the single newline
added to warning_pre_print causes them to be double-spaced.  (The
comment should say that adding two newlines to warning_pre_print would
make the warnings triple-spaced.)  Also, the newline that is intended
to end the copyright message ends up adding a blank line _after_ the
warning.  This looks bad.  It's ironic -- the desired behavior would
be a blank before the warning, but instead you get a blank after it.

*) Some messages printed before the newline are neither errors nor
warnings, e.g., "no debugging symbols found" from
symbol_file_add_with_addrs_or_offsets in symfile.c.  They may end up
on the same line as the end of the copyright message.  E.G.:

This GDB was configured as "i486-linux-gnu"...(no debugging symbols  
found)

OR

This GDB was configured as "i486-linux-gnu"...Using host libthread_db  
library "\
/lib/tls/i686/cmov/libthread_db.so.1".

This is confusing: neither the lack of debugging symbols nor the
libthread_db library has anything to do with how GDB was configured,
but the message makes it sound like there is some connection.

Here is a patch that fixes these problems, except for the
double-spaced warnings.  It prints the newline immediately after the
copyright message.  Since multiple warnings during this interval seem
unlikely to happen often, I don't see the double-spaced issue as being
so important, and the patch doesn't make that issue any different than
it is now.

Tested by building i686-pc-linux-gnu and running the testsuite --
there are some failures both with and without the patch and some of
the threading-related failures differ but I don't think the
differences have anything to do with the patch.

2006-07-19  Bob Wilson  <bob.wilson@acm.org>

         * main.c (captured_main): Print a newline after calling
         print_gdb_version instead of waiting until after the symbol  
file
         has been read.  Adjust {error,quit,warning}_pre_print values.


[-- Attachment #2: gdb-newline.diff --]
[-- Type: application/octet-stream, Size: 1540 bytes --]

Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.58
diff -u -r1.58 main.c
--- main.c	21 Feb 2006 19:46:48 -0000	1.58
+++ main.c	18 Jul 2006 22:24:49 -0000
@@ -589,6 +589,7 @@
       if (symarg)
 	printf_filtered ("..");
       wrap_here ("");
+      printf_filtered ("\n");
       gdb_flush (gdb_stdout);	/* Force to screen during slow operations */
     }
 
@@ -623,13 +624,13 @@
       if (symarg)
 	printf_filtered ("..");
       wrap_here ("");
+      printf_filtered ("\n");
       gdb_flush (gdb_stdout);	/* Force to screen during slow operations */
     }
 
-  error_pre_print = "\n\n";
+  /* Set off error and warning messages with a blank line.  */
+  error_pre_print = "\n";
   quit_pre_print = error_pre_print;
-
-  /* We may get more than one warning, don't double space all of them... */
   warning_pre_print = _("\nwarning: ");
 
   /* Read and execute $HOME/.gdbinit file, if it exists.  This is done
@@ -688,15 +689,6 @@
 	catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL);
     }
 
-  /* After the symbol file has been read, print a newline to get us
-     beyond the copyright line...  But errors should still set off
-     the error message with a (single) blank line.  */
-  if (!quiet)
-    printf_filtered ("\n");
-  error_pre_print = "\n";
-  quit_pre_print = error_pre_print;
-  warning_pre_print = _("\nwarning: ");
-
   if (corearg != NULL)
     {
       /* corearg may be either a corefile or a pid.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-27 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-19 20:35 [PATCH] print newline after copyright message Bob Wilson
2006-07-24 20:18 ` Daniel Jacobowitz
2006-07-24 20:43   ` Bob Wilson
2006-07-27 21:33     ` Daniel Jacobowitz
2006-07-27 23:06       ` Bob Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox