* as.h [NEED_DECLARATION_FFS] (ffs): Prototype and alphabetize.
[deliverable/binutils-gdb.git] / gdb / main.c
index e199a10d2fb56b0846e41dc4d9be05eac1bec863..a58f4919d10b303d2db49f845b322db6d48863e8 100644 (file)
@@ -1,7 +1,7 @@
 /* Top level stuff for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -28,6 +28,7 @@
 #include "symfile.h"
 #include "gdbcore.h"
 
+#include "exceptions.h"
 #include "getopt.h"
 
 #include <sys/types.h>
@@ -49,12 +50,6 @@ int display_time;
 
 int display_space;
 
-/* Whether this is the async version or not.  The async version is
-   invoked on the command line with the -nw --async options.  In this
-   version, the usual command_loop is substituted by and event loop which
-   processes UI events asynchronously. */
-int event_loop_p = 1;
-
 /* The selected interpreter.  This will be used as a set command
    variable, so it should always be malloc'ed - since
    do_setshow_command will free it. */
@@ -163,11 +158,6 @@ captured_main (void *data)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  START_PROGRESS (argv[0], 0);
-
-  /* This needs to happen before the first use of malloc.  */
-  init_malloc (NULL);
-
 #ifdef HAVE_SBRK
   lim_at_start = (char *) sbrk (0);
 #endif
@@ -201,9 +191,6 @@ captured_main (void *data)
   gdb_stdtargerr = gdb_stderr; /* for moment */
   gdb_stdtargin = gdb_stdin;   /* for moment */
 
-  /* initialize error() */
-  error_init ();
-
   /* Set the sysroot path.  */
 #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
   gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT);
@@ -255,8 +242,6 @@ captured_main (void *data)
     };
     static struct option long_options[] =
     {
-      {"async", no_argument, &event_loop_p, 1},
-      {"noasync", no_argument, &event_loop_p, 0},
 #if defined(TUI)
       {"tui", no_argument, 0, OPT_TUI},
 #endif
@@ -313,6 +298,7 @@ captured_main (void *data)
       {"statistics", no_argument, 0, OPT_STATISTICS},
       {"write", no_argument, &write_files, 1},
       {"args", no_argument, &set_args, 1},
+     {"l", required_argument, 0, 'l'},
       {0, no_argument, 0, 0}
     };
 
@@ -529,7 +515,7 @@ extern int gdbtk_test (char *);
   }
 
   /* Initialize all files.  Give the interpreter a chance to take
-     control of the console via the init_ui_hook()) */
+     control of the console via the deprecated_init_ui_hook ().  */
   gdb_init (argv[0]);
 
   /* Do these (and anything which might call wrap_here or *_filtered)
@@ -575,7 +561,7 @@ extern int gdbtk_test (char *);
     /* Find it.  */
     struct interp *interp = interp_lookup (interpreter_p);
     if (interp == NULL)
-      error ("Interpreter `%s' unrecognized", interpreter_p);
+      error (_("Interpreter `%s' unrecognized"), interpreter_p);
     /* Install it.  */
     if (!interp_set (interp))
       {
@@ -739,6 +725,13 @@ extern int gdbtk_test (char *);
 
   if (batch)
     {
+      if (attach_flag)
+       /* Either there was a problem executing the command in the
+          batch file aborted early, or the batch file forgot to do an
+          explicit detach.  Explicitly detach the inferior ensuring
+          that there are no zombies.  */
+       target_detach (NULL, 0);
+      
       /* We have hit the end of the batch file.  */
       exit (0);
     }
@@ -750,8 +743,6 @@ extern int gdbtk_test (char *);
   BEFORE_MAIN_LOOP_HOOK;
 #endif
 
-  END_PROGRESS (argv[0]);
-
   /* Show time and/or space usage.  */
 
   if (display_time)
@@ -780,13 +771,13 @@ extern int gdbtk_test (char *);
       if (!SET_TOP_LEVEL ())
        {
          do_cleanups (ALL_CLEANUPS);   /* Do complete cleanup */
-         /* GUIs generally have their own command loop, mainloop, or whatever.
-            This is a good place to gain control because many error
-            conditions will end up here via longjmp(). */
-         if (command_loop_hook)
-           command_loop_hook ();
+         /* GUIs generally have their own command loop, mainloop, or
+            whatever.  This is a good place to gain control because
+            many error conditions will end up here via longjmp().  */
+         if (deprecated_command_loop_hook)
+           deprecated_command_loop_hook ();
          else
-           command_loop ();
+           deprecated_command_loop ();
          quit_command ((char *) 0, instream == stdin);
        }
     }
@@ -837,9 +828,6 @@ Options:\n\n\
 "), stream);
   fputs_unfiltered (_("\
   --args             Arguments after executable-file are passed to inferior\n\
-"), stream);
-  fputs_unfiltered (_("\
-  --[no]async        Enable (disable) asynchronous version of CLI\n\
 "), stream);
   fputs_unfiltered (_("\
   -b BAUDRATE        Set serial port baud rate used for remote debugging.\n\
@@ -862,6 +850,7 @@ Options:\n\n\
                      Select a specific interpreter / user interface\n\
 "), stream);
   fputs_unfiltered (_("\
+  -l TIMEOUT         Set timeout in seconds for remote debugging.\n\
   --mapped           Use mapped symbol files if supported on this system.\n\
   --nw              Do not use a window interface.\n\
   --nx               Do not read "), stream);
This page took 0.031145 seconds and 4 git commands to generate.