diff options
author | John Gilmore <gnu@cygnus> | 1991-09-10 08:56:09 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-09-10 08:56:09 +0000 |
commit | 81066208879cefefce3b900b852483a77ed23c2a (patch) | |
tree | 1297f375636d5d218cff99ebbef36f86d6470870 /gdb/main.c | |
parent | ae07c044c3bf2e107226e9b719d9595a92e7af3e (diff) | |
download | gdb-81066208879cefefce3b900b852483a77ed23c2a.zip gdb-81066208879cefefce3b900b852483a77ed23c2a.tar.gz gdb-81066208879cefefce3b900b852483a77ed23c2a.tar.bz2 |
* utils.c (error): if error_pre_print is set, print the string
first.
* main.c (main, print_gnu_advertisement, print_gdb_version):
Reformat legalese so it always prints, but acts as an "I'm here"
message while symbols are being read. If any errors occur,
print a few newlines to set off the message and start it at the
left margin. Remove mention of "help" command, and don't yak about
symbol reading.
(catch_errors): Error string is now printed first in case of
error, not last.
* command.c (undef_cmd_error, lookup_cmd): On undefined command,
suggest the "help" command.
* Makefile.in (VERSION): Set to 4.0.2.
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 73 |
1 files changed, 48 insertions, 25 deletions
@@ -76,6 +76,10 @@ char gdbinit[] = GDBINIT_FILENAME; extern char *version; +/* Message to be printed before the error message, when an error occurs. */ + +extern char *error_pre_print; + /* Flag for whether we want all the "from_tty" gubbish printed. */ int caution = 1; /* Default is yes, sigh. */ @@ -170,6 +174,7 @@ static void quit_command (); void command_loop (); static void source_command (); static void print_gdb_version (); +static void print_gnu_advertisement (); static void float_handler (); static void cd_command (); static void read_command_file (); @@ -225,8 +230,8 @@ return_to_top_level () /* Call FUNC with arg ARGS, catching any errors. If there is no error, return the value returned by FUNC. - If there is an error, return zero after printing ERRSTRING - (which is in addition to the specific error message already printed). */ + If there is an error, print ERRSTRING, print the specific error message, + then return zero. */ int catch_errors (func, args, errstring) @@ -237,22 +242,22 @@ catch_errors (func, args, errstring) jmp_buf saved; int val; struct cleanup *saved_cleanup_chain; + char *saved_error_pre_print; saved_cleanup_chain = save_cleanups (); + saved_error_pre_print = error_pre_print; bcopy (to_top_level, saved, sizeof (jmp_buf)); + error_pre_print = errstring; if (setjmp (to_top_level) == 0) val = (*func) (args); else - { - if (errstring) - fprintf (stderr, "%s\n", errstring); - val = 0; - } + val = 0; restore_cleanups (saved_cleanup_chain); + error_pre_print = saved_error_pre_print; bcopy (saved, to_top_level, sizeof (jmp_buf)); return val; } @@ -531,16 +536,18 @@ GDB manual (available as on-line info or a printed manual).\n", stderr); if (!quiet) { - /* Print all the junk in one place, with a blank line after it - to separate it from important stuff like "no such file". - Also, we skip most of the noise, like Emacs, if started with - a file name rather than with no arguments. */ - if (execarg == 0) { - print_gdb_version (1); - printf ("Type \"help\" for a list of commands.\n\n"); - } + /* Print all the junk at the top, with trailing "..." if we are about + to read a symbol file (possibly slowly). */ + print_gnu_advertisement (); + print_gdb_version (); + if (symarg) + printf_filtered (".."); + wrap_here(); + fflush (stdout); /* Force to screen during slow operations */ } + error_pre_print = "\n\n"; + /* Now perform all the actions indicated by the arguments. */ if (cdarg != NULL) { @@ -567,7 +574,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr); if (!setjmp (to_top_level)) { exec_file_command (execarg, !batch); - symbol_file_command (symarg, !batch); + symbol_file_command (symarg, 0); } } else @@ -577,10 +584,16 @@ GDB manual (available as on-line info or a printed manual).\n", stderr); exec_file_command (execarg, !batch); if (symarg != NULL) if (!setjmp (to_top_level)) - symbol_file_command (symarg, !batch); + symbol_file_command (symarg, 0); } do_cleanups (ALL_CLEANUPS); + /* 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. */ + printf_filtered ("\n"); + error_pre_print = "\n"; + if (corearg != NULL) if (!setjmp (to_top_level)) core_file_command (corearg, !batch); @@ -597,6 +610,9 @@ GDB manual (available as on-line info or a printed manual).\n", stderr); ADDITIONAL_OPTION_HANDLER; #endif + /* Error messages should no longer be distinguished with extra output. */ + error_pre_print = 0; + { struct stat homebuf, cwdbuf; char *homedir, *homeinit; @@ -1516,16 +1532,21 @@ End with a line saying just \"end\".\n", comname); } static void -print_gdb_version (shout) - int shout; +print_gnu_advertisement() { - printf ("GDB %s, Copyright (C) 1991 Free Software Foundation, Inc.\n", - version); - if (shout) printf ("\ -There is ABSOLUTELY NO WARRANTY for GDB; type \"info warranty\" for details.\n\ GDB is free software and you are welcome to distribute copies of it\n\ - under certain conditions; type \"info copying\" to see the conditions.\n"); + under certain conditions; type \"info copying\" to see the conditions.\n\ +There is absolutely no warranty for GDB; type \"info warranty\" for details.\n\ +"); +} + +static void +print_gdb_version () +{ + printf_filtered ("\ +GDB %s, Copyright 1991 Free Software Foundation, Inc.", + version); } /* ARGSUSED */ @@ -1535,7 +1556,9 @@ show_version (args, from_tty) int from_tty; { immediate_quit++; - print_gdb_version (0); + print_gnu_advertisement (); + print_gdb_version (); + printf_filtered ("\n"); immediate_quit--; } |