Unify startup and option-parsing warnings
Various warnings are emitted during startup and option-parsing using fprintf_unfiltered. One warning is prefixed with the command name, the others are not. This commit replaces these hardwired warnings with calls to warning. It also sets warning_pre_print to prefix all warnings with the command name until option parsing is complete. gdb/ChangeLog: * main.c (captured_main): Use warning during startup. Prefix startup warning messages with command name.
This commit is contained in:
parent
91b35fd05c
commit
075c703382
|
@ -1,3 +1,8 @@
|
||||||
|
2014-08-29 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
|
* main.c (captured_main): Use warning during startup.
|
||||||
|
Prefix startup warning messages with command name.
|
||||||
|
|
||||||
2014-08-29 Gary Benson <gbenson@redhat.com>
|
2014-08-29 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
* main.c (captured_main): Handle usage errors with error.
|
* main.c (captured_main): Handle usage errors with error.
|
||||||
|
|
29
gdb/main.c
29
gdb/main.c
|
@ -517,13 +517,11 @@ captured_main (void *data)
|
||||||
gdb_program_name = xstrdup (argv[0]);
|
gdb_program_name = xstrdup (argv[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Prefix warning messages with the command name. */
|
||||||
|
warning_pre_print = xstrprintf ("%s: warning: ", gdb_program_name);
|
||||||
|
|
||||||
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
|
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
|
||||||
/* Don't use *_filtered or warning() (which relies on
|
perror_warning_with_name (_("error finding working directory"));
|
||||||
current_target) until after initialize_all_files(). */
|
|
||||||
fprintf_unfiltered (gdb_stderr,
|
|
||||||
_("%s: warning: error finding "
|
|
||||||
"working directory: %s\n"),
|
|
||||||
argv[0], safe_strerror (errno));
|
|
||||||
|
|
||||||
current_directory = gdb_dirbuf;
|
current_directory = gdb_dirbuf;
|
||||||
|
|
||||||
|
@ -807,13 +805,8 @@ captured_main (void *data)
|
||||||
|
|
||||||
i = strtol (optarg, &p, 0);
|
i = strtol (optarg, &p, 0);
|
||||||
if (i == 0 && p == optarg)
|
if (i == 0 && p == optarg)
|
||||||
|
warning (_("could not set baud rate to `%s'."),
|
||||||
/* Don't use *_filtered or warning() (which relies on
|
optarg);
|
||||||
current_target) until after initialize_all_files(). */
|
|
||||||
|
|
||||||
fprintf_unfiltered
|
|
||||||
(gdb_stderr,
|
|
||||||
_("warning: could not set baud rate to `%s'.\n"), optarg);
|
|
||||||
else
|
else
|
||||||
baud_rate = i;
|
baud_rate = i;
|
||||||
}
|
}
|
||||||
|
@ -825,13 +818,8 @@ captured_main (void *data)
|
||||||
|
|
||||||
i = strtol (optarg, &p, 0);
|
i = strtol (optarg, &p, 0);
|
||||||
if (i == 0 && p == optarg)
|
if (i == 0 && p == optarg)
|
||||||
|
warning (_("could not set timeout limit to `%s'."),
|
||||||
/* Don't use *_filtered or warning() (which relies on
|
optarg);
|
||||||
current_target) until after initialize_all_files(). */
|
|
||||||
|
|
||||||
fprintf_unfiltered (gdb_stderr,
|
|
||||||
_("warning: could not set "
|
|
||||||
"timeout limit to `%s'.\n"), optarg);
|
|
||||||
else
|
else
|
||||||
remote_timeout = i;
|
remote_timeout = i;
|
||||||
}
|
}
|
||||||
|
@ -985,6 +973,7 @@ captured_main (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set off error and warning messages with a blank line. */
|
/* Set off error and warning messages with a blank line. */
|
||||||
|
xfree (warning_pre_print);
|
||||||
warning_pre_print = _("\nwarning: ");
|
warning_pre_print = _("\nwarning: ");
|
||||||
|
|
||||||
/* Read and execute the system-wide gdbinit file, if it exists.
|
/* Read and execute the system-wide gdbinit file, if it exists.
|
||||||
|
|
Loading…
Reference in New Issue