Revert call to bfd_cache_close().
[deliverable/binutils-gdb.git] / gdb / main.c
index c6b9516f99a17183b138ce2a747c93e99cb04fa2..ceac1327e3566824a43367d9bd1347bd0898909b 100644 (file)
@@ -1,5 +1,6 @@
 /* Top level stuff for GDB, the GNU debugger.
-   Copyright 1986-1995, 1999-2000 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,7 +23,8 @@
 #include "top.h"
 #include "target.h"
 #include "inferior.h"
-#include "call-cmds.h"
+#include "symfile.h"
+#include "gdbcore.h"
 
 #include "getopt.h"
 
@@ -33,7 +35,8 @@
 #include "gdb_string.h"
 #include "event-loop.h"
 #include "ui-out.h"
-#if defined (TUI) || defined (GDBTK)
+
+#if defined (TUI)
 /* FIXME: cagney/2000-01-31: This #include is to allow older code such
    as that found in the TUI to continue to build. */
 #include "tui/tui-file.h"
@@ -88,7 +91,6 @@ extern int enable_external_editor;
 extern char *external_editor_command;
 
 #ifdef __CYGWIN__
-#include <windows.h>           /* for MAX_PATH */
 #include <sys/cygwin.h>                /* for cygwin32_conv_to_posix_path */
 #endif
 
@@ -105,7 +107,7 @@ captured_command_loop (void *data)
   /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton
      would clean things up (restoring the cleanup chain) to the state
      they were just prior to the call.  Technically, this means that
-     the do_cleanups() below is redundant.  Unfortunatly, many FUNC's
+     the do_cleanups() below is redundant.  Unfortunately, many FUNCs
      are not that well behaved.  do_cleanups should either be replaced
      with a do_cleanups call (to cover the problem) or an assertion
      check to detect bad FUNCs code. */
@@ -197,10 +199,7 @@ captured_main (void *data)
   getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   current_directory = gdb_dirbuf;
 
-#if defined (TUI) || defined (GDBTK)
-  /* Older code uses the tui_file and fputs_unfiltered_hook().  It
-     should be using a customized UI_FILE object and re-initializing
-     within its own _initialize function.  */
+#if defined (TUI)
   gdb_stdout = tui_fileopen (stdout);
   gdb_stderr = tui_fileopen (stderr);
   gdb_stdlog = gdb_stdout;     /* for moment */
@@ -474,6 +473,7 @@ extern int gdbtk_test (char *);
          execarg = argv[optind];
          break;
        case 2:
+         /* FIXME: The documentation says this can be a "ProcID". as well. */
          corearg = argv[optind];
          break;
        case 3:
@@ -534,13 +534,13 @@ extern int gdbtk_test (char *);
      *before* all the command line arguments are processed; it sets
      global parameters, which are independent of what file you are
      debugging or what directory you are in.  */
-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
   {
     char *tmp = getenv ("HOME");
 
     if (tmp != NULL)
       {
-       homedir = (char *) alloca (MAX_PATH + 1);
+       homedir = (char *) alloca (PATH_MAX + 1);
        cygwin32_conv_to_posix_path (tmp, homedir);
       }
     else
@@ -583,7 +583,7 @@ extern int gdbtk_test (char *);
 
   for (i = 0; i < ndir; i++)
     catch_command_errors (directory_command, dirarg[i], 0, RETURN_MASK_ALL);
-  free ((PTR) dirarg);
+  xfree (dirarg);
 
   if (execarg != NULL
       && symarg != NULL
@@ -592,15 +592,15 @@ extern int gdbtk_test (char *);
       /* The exec file and the symbol-file are the same.  If we can't
          open it, better only print one error message.
          catch_command_errors returns non-zero on success! */
-      if (catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL))
-       catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
+      if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL))
+       catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL);
     }
   else
     {
       if (execarg != NULL)
-       catch_command_errors (exec_file_command, execarg, !batch, RETURN_MASK_ALL);
+       catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL);
       if (symarg != NULL)
-       catch_command_errors (symbol_file_command, symarg, 0, RETURN_MASK_ALL);
+       catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL);
     }
 
   /* After the symbol file has been read, print a newline to get us
@@ -665,7 +665,7 @@ extern int gdbtk_test (char *);
 #endif
       catch_command_errors (source_command, cmdarg[i], !batch, RETURN_MASK_ALL);
     }
-  free ((PTR) cmdarg);
+  xfree (cmdarg);
 
   /* Read in the old history after all the command files have been read. */
   init_history ();
This page took 0.026322 seconds and 4 git commands to generate.