This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] print newline after copyright message


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: gdb-newline.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]