diff options
-rw-r--r-- | gdb/ChangeLog | 22 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/command.c | 19 | ||||
-rw-r--r-- | gdb/main.c | 73 | ||||
-rw-r--r-- | gdb/utils.c | 6 |
5 files changed, 93 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 547a6ef..701b8e3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +Mon Sep 9 13:45:57 1991 John Gilmore (gnu at cygint.cygnus.com) + + * breakpoint.c (insert_breakpoints): Restore warning about + the program might be running in another process, but only for + systems with this brain death (#ifdef ONE_PROCESS_WRITETEXT). + * xm-hp300bsd.h, xm-mips.h, xm-vax.h: Define it. + + * 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. + Thu Sep 5 23:49:48 1991 John Gilmore (gnu at cygint.cygnus.com) * .gdbinit: Remove useless "rr" command. Set complaints diff --git a/gdb/Makefile.in b/gdb/Makefile.in index dde9d1d..2213be4 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -132,7 +132,7 @@ CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${LIBIBERTY} ${RL_LIB} ADD_FILES = ${REGEX} ${ALLOCA} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES} ADD_DEPS = ${REGEX1} ${ALLOCA1} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES} -VERSION = 4.0.1 +VERSION = 4.0.2 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/command.c b/gdb/command.c index 15d4297..3c05e6c 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -585,6 +585,20 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes) } } +/* All this hair to move the space to the front of cmdtype */ + +void +undef_cmd_error (cmdtype, q) + char *cmdtype, *q; +{ + error ("Undefined %scommand: \"%s\". Try \"help%s%.*s\".", + cmdtype, + q, + *cmdtype? " ": "", + strlen(cmdtype)-1, + cmdtype); +} + /* Look up the contents of *LINE as a command in the command list LIST. LIST is a chain of struct cmd_list_element's. If it is found, return the struct cmd_list_element for that command @@ -633,8 +647,7 @@ lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes) q = (char *) alloca (p - *line + 1); strncpy (q, *line, p - *line); q[p-*line] = '\0'; - - error ("Undefined %scommand: \"%s\".", cmdtype, q); + undef_cmd_error (cmdtype, q); } } else @@ -698,7 +711,7 @@ lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes) (*line)++; if (c->prefixlist && **line && !c->allow_unknown) - error ("Undefined %scommand: \"%s\".", c->prefixname, *line); + undef_cmd_error (c->prefixname, *line); /* Seems to be what he wants. Return it. */ return c; @@ -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--; } diff --git a/gdb/utils.c b/gdb/utils.c index 632616e..98adad0 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -101,6 +101,10 @@ int asm_demangle = 0; international character, and the terminal or window can cope.) */ int sevenbit_strings = 0; + +/* String to be printed before error messages, if any. */ + +char *error_pre_print; /* Add a new cleanup to the cleanup_chain, and return the previous chain pointer @@ -203,6 +207,8 @@ error (va_alist) va_start (args); target_terminal_ours (); fflush (stdout); + if (error_pre_print) + fprintf (stderr, error_pre_print); string = va_arg (args, char *); vfprintf (stderr, string, args); fprintf (stderr, "\n"); |