#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
+#include <ctype.h>
/* Global variables owned by this file */
static void
find_sym_fns PARAMS ((struct objfile *));
-static void
+void
clear_symtab_users_once PARAMS ((void));
/* List of all available sym_fns. On gdb startup, each object file reader
TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
TYPE_NAME (lookup_pointer_type (builtin_type_void)) = 0;
+ /* Mark the objfile has having had initial symbol read attempted. Note
+ that this does not mean we found any symbols... */
+
+ objfile -> flags |= OBJF_SYMS;
+}
+
+/* Perform required actions immediately after either reading in the initial
+ symbols for a new objfile, or mapping in the symbols from a reusable
+ objfile. */
+
+void
+new_symfile_objfile (objfile, mainline, verbo)
+ struct objfile *objfile;
+ int mainline;
+ int verbo;
+{
if (mainline)
{
/* OK, make it the "real" symbol file. */
struct objfile *objfile;
struct partial_symtab *psymtab;
bfd *abfd;
- int mapped_it;
/* Open a bfd for the file and then check to see if the file has a
symbol table. There is a distinction between having no symbol table
wrap_here ("");
fflush (stdout);
}
+ init_entry_point_info (objfile);
+ find_sym_fns (objfile);
}
else
{
fflush (stdout);
}
syms_from_objfile (objfile, addr, mainline, from_tty);
- objfile -> flags |= OBJF_SYMS;
}
+ new_symfile_objfile (objfile, mainline, from_tty);
+
/* We now have at least a partial symbol table. Check to see if the
user requested that all symbols be read on initial access via either
the gdb startup command line or on a per symbol file basis. Expand
psymtab != NULL;
psymtab = psymtab -> next)
{
- (void) psymtab_to_symtab (psymtab);
+ psymtab_to_symtab (psymtab);
}
}
char **argv;
char *name = NULL;
struct cleanup *cleanups;
- struct objfile *objfile;
int mapped = 0;
int readnow = 0;
error ("Not confirmed.");
free_all_objfiles ();
symfile_objfile = NULL;
+ if (from_tty)
+ {
+ printf ("No symbol file now.\n");
+ }
}
else
{
/* Getting new symbols may change our opinion about what is
frameless. */
reinit_frame_cache ();
- objfile = symbol_file_add (name, from_tty, (CORE_ADDR)0, 1,
- mapped, readnow);
+ symbol_file_add (name, from_tty, (CORE_ADDR)0, 1, mapped, readnow);
}
do_cleanups (cleanups);
}
}
free (name); /* Free 1st new malloc'd copy */
name = absolute_name; /* Keep 2nd malloc'd copy in bfd */
+ /* It'll be freed in free_objfile(). */
sym_bfd = bfd_fdopenr (name, NULL, desc);
if (!sym_bfd)
find_sym_fns (objfile)
struct objfile *objfile;
{
- struct sym_fns *sf, *sf2;
+ struct sym_fns *sf;
for (sf = symtab_fns; sf != NULL; sf = sf -> next)
{
char *name = NULL;
CORE_ADDR text_addr;
char *arg;
- int readnow;
- int mapped;
+ int readnow = 0;
+ int mapped = 0;
dont_repeat ();
reinit_frame_cache ();
- (void) symbol_file_add (name, 0, text_addr, 0, mapped, readnow);
+ symbol_file_add (name, 0, text_addr, 0, mapped, readnow);
}
\f
/* Re-read symbols if a symbol-file has changed. */
the_big_top:
for (objfile = object_files; objfile; objfile = objfile->next) {
if (objfile->obfd) {
-#ifdef IBM6000
+#ifdef IBM6000_TARGET
/* If this object is from a shared library, then you should
stat on the library name, not member name. */
symtab = (struct symtab *)
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symtab));
- (void) memset (symtab, 0, sizeof (*symtab));
+ memset (symtab, 0, sizeof (*symtab));
symtab -> filename = obsavestring (filename, strlen (filename),
&objfile -> symbol_obstack);
symtab -> fullname = NULL;
obstack_alloc (&objfile -> psymbol_obstack,
sizeof (struct partial_symtab));
- (void) memset (psymtab, 0, sizeof (struct partial_symtab));
+ memset (psymtab, 0, sizeof (struct partial_symtab));
psymtab -> filename = obsavestring (filename, strlen (filename),
&objfile -> psymbol_obstack);
psymtab -> symtab = NULL;
static int clear_symtab_users_queued;
static int clear_symtab_users_done;
-static void
+void
clear_symtab_users_once ()
{
/* Enforce once-per-`do_cleanups'-semantics */
free_named_symtabs (name)
char *name;
{
- register struct symtab *s;
- register struct symtab *prev;
- register struct partial_symtab *ps;
- struct blockvector *bv;
- int blewit = 0;
-
#if 0
/* FIXME: With the new method of each objfile having it's own
psymtab list, this function needs serious rethinking. In particular,
why was it ever necessary to toss psymtabs with specific compilation
unit filenames, as opposed to all psymtabs from a particular symbol
- file. */
+ file? -- fnf
+ Well, the answer is that some systems permit reloading of particular
+ compilation units. We want to blow away any old info about these
+ compilation units, regardless of which objfiles they arrived in. --gnu. */
+
+ register struct symtab *s;
+ register struct symtab *prev;
+ register struct partial_symtab *ps;
+ struct blockvector *bv;
+ int blewit = 0;
/* We only wack things if the symbol-reload switch is set. */
if (!symbol_reloading)
psymtab -> statics_offset = static_syms - objfile -> static_psymbols.list;
return (psymtab);
}
+\f
+/* Debugging versions of functions that are usually inline macros
+ (see symfile.h). */
+
+#if 0 /* Don't quite work nowadays... */
+
+/* Add a symbol with a long value to a psymtab.
+ Since one arg is a struct, we pass in a ptr and deref it (sigh). */
+
+void
+add_psymbol_to_list (name, namelength, namespace, class, list, val)
+ char *name;
+ int namelength;
+ enum namespace namespace;
+ enum address_class class;
+ struct psymbol_allocation_list *list;
+ long val;
+{
+ ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
+ SYMBOL_VALUE);
+}
+
+/* Add a symbol with a CORE_ADDR value to a psymtab. */
+
+void
+add_psymbol_addr_to_list (name, namelength, namespace, class, list, val)
+ char *name;
+ int namelength;
+ enum namespace namespace;
+ enum address_class class;
+ struct psymbol_allocation_list *list;
+ CORE_ADDR val;
+{
+ ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
+ SYMBOL_VALUE_ADDRESS);
+}
+#endif /* 0 */
\f
void
_initialize_symfile ()