* utils.c (query): Remove tui hacks; tui must use the query_hook.
[deliverable/binutils-gdb.git] / gdb / symfile.c
index 111a51b26ab6f23a201188f4804c8b810b54c8c2..4aa27bf2b7b8ab9cb164dc6e6094f62b7c816454 100644 (file)
@@ -37,7 +37,6 @@
 #include "inferior.h"          /* for write_pc */
 #include "gdb-stabs.h"
 #include "obstack.h"
-#include "completer.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
@@ -110,16 +109,14 @@ static void set_initial_language (void);
 
 static void load_command (char *, int);
 
+static void symbol_file_add_main_1 (char *args, int from_tty, int flags);
+
 static void add_symbol_file_command (char *, int);
 
 static void add_shared_symbol_files_command (char *, int);
 
 static void cashier_psymtab (struct partial_symtab *);
 
-static int compare_psymbols (const void *, const void *);
-
-static int compare_symbols (const void *, const void *);
-
 bfd *symfile_bfd_open (char *);
 
 static void find_sym_fns (struct objfile *);
@@ -207,7 +204,7 @@ int auto_solib_add = 1;
    comparison function takes two "void *" pointers. */
 
 static int
-compare_symbols (const PTR s1p, const PTR s2p)
+compare_symbols (const void *s1p, const void *s2p)
 {
   register struct symbol **s1, **s2;
 
@@ -239,7 +236,7 @@ compare_symbols (const PTR s1p, const PTR s2p)
  */
 
 static int
-compare_psymbols (const PTR s1p, const PTR s2p)
+compare_psymbols (const void *s1p, const void *s2p)
 {
   register struct partial_symbol **s1, **s2;
   register char *st1, *st2;
@@ -897,13 +894,34 @@ symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs,
   return (objfile);
 }
 
-/* Just call the above with default values.
-   Used when the file is supplied in the gdb command line. */
+/* Call symbol_file_add() with default values and update whatever is
+   affected by the loading of a new main().
+   Used when the file is supplied in the gdb command line
+   and by some targets with special loading requirements.
+   The auxiliary function, symbol_file_add_main_1(), has the flags
+   argument for the switches that can only be specified in the symbol_file
+   command itself.  */
    
 void
 symbol_file_add_main (char *args, int from_tty)
 {
-  symbol_file_add (args, from_tty, NULL, 1, 0);
+  symbol_file_add_main_1 (args, from_tty, 0);
+}
+
+static void
+symbol_file_add_main_1 (char *args, int from_tty, int flags)
+{
+  symbol_file_add (args, from_tty, NULL, 1, flags);
+
+#ifdef HPUXHPPA
+  RESET_HP_UX_GLOBALS ();
+#endif
+
+  /* Getting new symbols may change our opinion about
+     what is frameless.  */
+  reinit_frame_cache ();
+
+  set_initial_language ();
 }
 
 void
@@ -980,15 +998,8 @@ symbol_file_command (char *args, int from_tty)
              else
                {
                   name = *argv;
-                 symbol_file_add (name, from_tty, NULL, 1, flags);
-#ifdef HPUXHPPA
-                 RESET_HP_UX_GLOBALS ();
-#endif
-                 /* Getting new symbols may change our opinion about
-                    what is frameless.  */
-                 reinit_frame_cache ();
 
-                 set_initial_language ();
+                 symbol_file_add_main_1 (name, from_tty, flags);
                }
          argv++;
        }
@@ -997,7 +1008,6 @@ symbol_file_command (char *args, int from_tty)
        {
          error ("no symbol file name was specified");
        }
-      TUIDO (((TuiOpaqueFuncPtr) tuiDisplayMainFunction));
       do_cleanups (cleanups);
     }
 }
@@ -1053,7 +1063,7 @@ symfile_bfd_open (char *name)
 
   /* Look down path for it, allocate 2nd new malloc'd copy.  */
   desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
-#if defined(__GO32__) || defined(_WIN32)
+#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
   if (desc < 0)
     {
       char *exename = alloca (strlen (name) + 5);
@@ -1782,8 +1792,8 @@ add_filename_language (char *ext, enum language lang)
   if (fl_table_next >= fl_table_size)
     {
       fl_table_size += 10;
-      filename_language_table = realloc (filename_language_table,
-                                        fl_table_size);
+      filename_language_table = xrealloc (filename_language_table,
+                                         fl_table_size);
     }
 
   filename_language_table[fl_table_next].ext = xstrdup (ext);
This page took 0.025843 seconds and 4 git commands to generate.