This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Report an invalid interpreter using error
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 20 Mar 2003 17:29:51 -0500
- Subject: [commit] Report an invalid interpreter using error
I some how (details in next patch) managed to create a GDB with no
interpreter! It would start up with:
$ gdb
Interpreter "console" unrecognized
$
Debugging it proved interesting. It turned out that the message wasn't
being reported via error(), warning() or complaint(). The attached
`fixes' that part of the problem by using error(). Hopefully this will
make the next persons debugging life easier :-)
committed,
Andrew
2003-03-20 Andrew Cagney <cagney at redhat dot com>
* main.c (gdb_main): Return 1.
(captured_main): Call error to report an invalid interpreter.
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.31
diff -u -r1.31 main.c
--- main.c 2 Mar 2003 02:07:12 -0000 1.31
+++ main.c 20 Mar 2003 22:23:39 -0000
@@ -570,11 +570,7 @@
/* Find it. */
struct interp *interp = interp_lookup (interpreter_p);
if (interp == NULL)
- {
- fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
- interpreter_p);
- exit (1);
- }
+ error ("Interpreter `%s' unrecognized", interpreter_p);
/* Install it. */
if (!interp_set (interp))
{
@@ -815,7 +811,9 @@
{
use_windows = args->use_windows;
catch_errors (captured_main, args, "", RETURN_MASK_ALL);
- return 0;
+ /* The only way to end up here is by an error (normal exit is
+ handled by quit_force()), hence always return an error status. */
+ return 1;
}