1 /* Generic symbol file reading for the GNU debugger, GDB.
2 Copyright 1990, 1991 Free Software Foundation, Inc.
3 Contributed by Cygnus Support, using pieces from other GDB modules.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
31 #include "breakpoint.h"
36 #include <sys/types.h>
41 CORE_ADDR entry_point; /* Where execution starts in symfile */
43 extern int info_verbose;
46 extern char *getenv ();
47 extern char *rindex ();
49 extern CORE_ADDR startup_file_start; /* From blockframe.c */
50 extern CORE_ADDR startup_file_end; /* From blockframe.c */
52 /* Functions this file defines */
53 static bfd *symfile_open();
54 static struct sym_fns *symfile_init();
55 static void clear_symtab_users_once();
57 /* List of all available sym_fns. */
59 struct sym_fns *symtab_fns = NULL;
61 /* Saves the sym_fns of the current symbol table, so we can call
62 the right XXX_new_init function when we free it. FIXME. This
63 should be extended to calling the new_init function for each
64 existing symtab or psymtab, since the main symbol file and
65 subsequent added symbol files can have different types. */
67 static struct sym_fns *symfile_fns;
69 /* Allocate an obstack to hold objects that should be freed
70 when we load a new symbol table.
71 This includes the symbols made by dbxread
72 and the types that are not permanent. */
74 struct obstack obstack1;
76 struct obstack *symbol_obstack = &obstack1;
78 /* This obstack will be used for partial_symbol objects. It can
79 probably actually be the same as the symbol_obstack above, but I'd
80 like to keep them seperate for now. If I want to later, I'll
81 replace one with the other. */
83 struct obstack obstack2;
85 struct obstack *psymbol_obstack = &obstack2;
87 /* File name symbols were loaded from. */
91 /* The modification date of the file when they were loaded. */
93 long /* really time_t */ symfile_mtime = 0;
95 /* Structures with which to manage partial symbol allocation. */
98 struct psymbol_allocation_list global_psymbols = {0}, static_psymbols = {0};
100 /* Flag for whether user will be reloading symbols multiple times.
101 Defaults to ON for VxWorks, otherwise OFF. */
103 #ifdef SYMBOL_RELOADING_DEFAULT
104 int symbol_reloading = SYMBOL_RELOADING_DEFAULT;
106 int symbol_reloading = 0;
109 /* Structure to manage complaints about symbol file contents. */
111 struct complaint complaint_root[1] = {
112 {(char *)0, 0, complaint_root},
115 /* Some actual complaints. */
117 struct complaint oldsyms_complaint = {
118 "Replacing old symbols for `%s'", 0, 0 };
120 struct complaint empty_symtab_complaint = {
121 "Empty symbol table found for `%s'", 0, 0 };
124 /* In the following sort, we always make sure that
125 register debug symbol declarations always come before regular
126 debug symbol declarations (as might happen when parameters are
127 then put into registers by the compiler). */
130 compare_symbols (s1, s2)
131 struct symbol **s1, **s2;
133 register int namediff;
135 /* Compare the initial characters. */
136 namediff = SYMBOL_NAME (*s1)[0] - SYMBOL_NAME (*s2)[0];
137 if (namediff != 0) return namediff;
139 /* If they match, compare the rest of the names. */
140 namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
141 if (namediff != 0) return namediff;
143 /* For symbols of the same name, registers should come first. */
144 return ((SYMBOL_CLASS (*s2) == LOC_REGISTER)
145 - (SYMBOL_CLASS (*s1) == LOC_REGISTER));
148 /* Call sort_block_syms to sort alphabetically the symbols of one block. */
152 register struct block *b;
154 qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
155 sizeof (struct symbol *), compare_symbols);
158 /* Call sort_symtab_syms to sort alphabetically
159 the symbols of each block of one symtab. */
163 register struct symtab *s;
165 register struct blockvector *bv;
168 register struct block *b;
172 bv = BLOCKVECTOR (s);
173 nbl = BLOCKVECTOR_NBLOCKS (bv);
174 for (i = 0; i < nbl; i++)
176 b = BLOCKVECTOR_BLOCK (bv, i);
177 if (BLOCK_SHOULD_SORT (b))
183 sort_all_symtab_syms ()
185 register struct symtab *s;
187 for (s = symtab_list; s; s = s->next)
189 sort_symtab_syms (s);
193 /* Make a copy of the string at PTR with SIZE characters in the symbol obstack
194 (and add a null character at the end in the copy).
195 Returns the address of the copy. */
198 obsavestring (ptr, size)
202 register char *p = (char *) obstack_alloc (symbol_obstack, size + 1);
203 /* Open-coded bcopy--saves function call time.
204 These strings are usually short. */
206 register char *p1 = ptr;
207 register char *p2 = p;
208 char *end = ptr + size;
216 /* Concatenate strings S1, S2 and S3; return the new string.
217 Space is found in the symbol_obstack. */
220 obconcat (s1, s2, s3)
223 register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
224 register char *val = (char *) obstack_alloc (symbol_obstack, len);
231 /* Accumulate the misc functions in bunches of 127.
232 At the end, copy them all into one newly allocated structure. */
234 #define MISC_BUNCH_SIZE 127
238 struct misc_bunch *next;
239 struct misc_function contents[MISC_BUNCH_SIZE];
242 /* Bunch currently being filled up.
243 The next field points to chain of filled bunches. */
245 static struct misc_bunch *misc_bunch;
247 /* Number of slots filled in current bunch. */
249 static int misc_bunch_index;
251 /* Total number of misc functions recorded so far. */
253 static int misc_count;
260 misc_bunch_index = MISC_BUNCH_SIZE;
264 prim_record_misc_function (name, address, misc_type)
267 enum misc_function_type misc_type;
269 register struct misc_bunch *new;
271 if (misc_bunch_index == MISC_BUNCH_SIZE)
273 new = (struct misc_bunch *) xmalloc (sizeof (struct misc_bunch));
274 misc_bunch_index = 0;
275 new->next = misc_bunch;
278 misc_bunch->contents[misc_bunch_index].name = name;
279 misc_bunch->contents[misc_bunch_index].address = address;
280 misc_bunch->contents[misc_bunch_index].type = misc_type;
281 misc_bunch->contents[misc_bunch_index].misc_info = 0;
287 compare_misc_functions (fn1, fn2)
288 struct misc_function *fn1, *fn2;
290 /* Return a signed result based on unsigned comparisons
291 so that we sort into unsigned numeric order. */
292 if (fn1->address < fn2->address)
294 if (fn1->address > fn2->address)
301 discard_misc_bunches (foo)
304 register struct misc_bunch *next;
308 next = misc_bunch->next;
314 /* INCLINK nonzero means bunches are from an incrementally-linked file.
315 Add them to the existing bunches.
316 Otherwise INCLINK is zero, and we start from scratch. */
318 condense_misc_bunches (inclink)
322 register struct misc_bunch *bunch;
327 = (struct misc_function *)
328 xrealloc (misc_function_vector, (misc_count + misc_function_count)
329 * sizeof (struct misc_function));
330 j = misc_function_count;
335 = (struct misc_function *)
336 xmalloc (misc_count * sizeof (struct misc_function));
343 for (i = 0; i < misc_bunch_index; i++, j++)
345 misc_function_vector[j] = bunch->contents[i];
346 #ifdef NAMES_HAVE_UNDERSCORE
347 if (misc_function_vector[j].name[0] == '_')
348 misc_function_vector[j].name++;
350 #ifdef SOME_NAMES_HAVE_DOT
351 if (misc_function_vector[j].name[0] == '.')
352 misc_function_vector[j].name++;
357 misc_bunch_index = MISC_BUNCH_SIZE;
360 if (misc_function_count + misc_count != j) /* DEBUG */
361 printf_filtered ("Function counts are off! %d + %d != %d\n",
362 misc_function_count, misc_count, j);
364 misc_function_count = j;
366 /* Sort the misc functions by address. */
368 qsort (misc_function_vector, misc_function_count,
369 sizeof (struct misc_function),
370 compare_misc_functions);
374 /* Get the symbol table that corresponds to a partial_symtab.
375 This is fast after the first time you do it. In fact, there
376 is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
380 psymtab_to_symtab (pst)
381 register struct partial_symtab *pst;
383 /* If it's been looked up before, return it. */
387 /* If it has not yet been read in, read it. */
390 (*pst->read_symtab) (pst);
396 /* Process a symbol file, as either the main file or as a dynamically
399 NAME is the file name (which will be tilde-expanded and made
400 absolute herein) (but we don't free or modify NAME itself).
401 FROM_TTY says how verbose to be. MAINLINE specifies whether this
402 is the main symbol file, or whether it's an extra symbol file such
403 as dynamically loaded code. If !mainline, ADDR is the address
404 where the text segment was loaded. */
407 syms_from_bfd (sym_bfd, addr, mainline)
416 /* There is a distinction between having no symbol table
417 (we refuse to read the file, leaving the old set of symbols around)
418 and having no debugging symbols in your symbol table (we read
419 the file and end up with a mostly empty symbol table). */
421 if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS))
424 /* Save startup file's range of PC addresses to help blockframe.c
425 decide where the bottom of the stack is. */
426 if (bfd_get_file_flags (sym_bfd) & EXEC_P)
428 /* Executable file -- record its entry point so we'll recognize
429 the startup file because it contains the entry point. */
430 entry_point = bfd_get_start_address (sym_bfd);
434 /* Examination of non-executable.o files. Short-circuit this stuff. */
435 /* ~0 will not be in any file, we hope. */
437 /* set the startup file to be an empty range. */
438 startup_file_start = 0;
439 startup_file_end = 0;
442 sf = symfile_init (sym_bfd);
443 realname = bfd_get_filename (sym_bfd);
444 realname = savestring (realname, strlen (realname));
445 /* FIXME, this probably creates a storage leak... */
449 /* Since no error yet, throw away the old symbol table. */
455 free_all_psymtabs ();
457 (*sf->sym_new_init) ();
459 /* For mainline, caller didn't know the specified address of the
460 text section. We fix that here. */
461 text_sect = bfd_get_section_by_name (sym_bfd, ".text");
462 addr = bfd_section_vma (sym_bfd, text_sect);
465 clear_complaints(); /* Allow complaints to appear for this new file. */
467 (*sf->sym_read) (sf, addr, mainline);
469 /* Don't allow char * to have a typename (else would get caddr_t.) */
470 /* Ditto void *. FIXME should do this for all the builtin types. */
472 TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
473 TYPE_NAME (lookup_pointer_type (builtin_type_void)) = 0;
477 /* OK, make it the "real" symbol file. */
482 /* If we have wiped out any old symbol tables, clean up. */
483 clear_symtab_users_once ();
487 /* Process a symbol file, as either the main file or as a dynamically
490 NAME is the file name (which will be tilde-expanded and made
491 absolute herein) (but we don't free or modify NAME itself).
492 FROM_TTY says how verbose to be. MAINLINE specifies whether this
493 is the main symbol file, or whether it's an extra symbol file such
494 as dynamically loaded code. If !mainline, ADDR is the address
495 where the text segment was loaded. */
498 symbol_file_add (name, from_tty, addr, mainline)
506 sym_bfd = symfile_open (name);
509 symfile_mtime = bfd_get_mtime (sym_bfd);
511 /* There is a distinction between having no symbol table
512 (we refuse to read the file, leaving the old set of symbols around)
513 and having no debugging symbols in your symbol table (we read
514 the file and end up with a mostly empty symbol table). */
516 if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS))
518 error ("%s has no symbol-table", name);
521 if ((symtab_list || partial_symtab_list)
524 && !query ("Load new symbol table from \"%s\"? ", name))
525 error ("Not confirmed.");
529 printf_filtered ("Reading symbols from %s...", name);
534 syms_from_bfd (sym_bfd, addr, mainline);
538 printf_filtered ("done.\n");
543 /* This is the symbol-file command. Read the file, analyze its symbols,
544 and add a struct symtab to symtab_list. */
547 symbol_file_command (name, from_tty)
556 if ((symtab_list || partial_symtab_list)
558 && !query ("Discard symbol table from `%s'? ", symfile))
559 error ("Not confirmed.");
564 free_all_psymtabs ();
565 /* FIXME, this does not account for the main file and subsequent
566 files (shared libs, dynloads, etc) having different formats.
567 It only calls the cleanup routine for the main file's format. */
569 (*symfile_fns->sym_new_init) ();
576 /* Getting new symbols may change our opinion about what is
578 reinit_frame_cache ();
580 symbol_file_add (name, from_tty, (CORE_ADDR)0, 1);
583 /* Open NAME and hand it off to BFD for preliminary analysis. Result
584 is a BFD *, which includes a new copy of NAME dynamically allocated
585 (which will be freed by the cleanup chain). In case of trouble,
586 error() is called. */
596 name = tilde_expand (name);
597 make_cleanup (free, name);
599 desc = openp (getenv ("PATH"), 1, name, O_RDONLY, 0, &absolute_name);
601 perror_with_name (name);
604 make_cleanup (free, absolute_name);
605 name = absolute_name;
608 sym_bfd = bfd_fdopenr (name, NULL, desc);
612 error ("Could not open `%s' to read symbols: %s",
613 name, bfd_errmsg (bfd_error));
615 make_cleanup (bfd_close, sym_bfd);
617 if (!bfd_check_format (sym_bfd, bfd_object))
618 error ("\"%s\": can't read symbols: %s.",
619 name, bfd_errmsg (bfd_error));
624 /* Link a new symtab_fns into the global symtab_fns list.
625 Called by various _initialize routines. */
631 sf->next = symtab_fns;
636 /* Initialize to read symbols from the symbol file sym_bfd. It either
637 returns or calls error(). The result is a malloc'd struct sym_fns
638 that contains cached information about the symbol file. */
640 static struct sym_fns *
641 symfile_init (sym_bfd)
644 struct sym_fns *sf, *sf2;
646 for (sf = symtab_fns; sf != NULL; sf = sf->next)
648 if (!strncmp (bfd_get_target (sym_bfd), sf->sym_name, sf->sym_namelen))
650 sf2 = (struct sym_fns *)xmalloc (sizeof (*sf2));
651 /* FIXME, who frees this? */
653 sf2->sym_bfd = sym_bfd;
654 sf2->sym_private = 0; /* Not alloc'd yet */
655 (*sf2->sym_init) (sf2);
659 error ("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown.",
660 bfd_get_target (sym_bfd));
661 return 0; /* Appease lint. */
664 /* This function runs the load command of our current target. */
667 load_command (arg, from_tty)
671 target_load (arg, from_tty);
674 /* This function allows the addition of incrementally linked object files.
675 It does not modify any state in the target, only in the debugger. */
679 add_symbol_file_command (arg_string, from_tty)
686 /* Getting new symbols may change our opinion about what is
688 reinit_frame_cache ();
691 error ("add-symbol-file takes a file name and an address");
693 arg_string = tilde_expand (arg_string);
694 make_cleanup (free, arg_string);
696 for( ; *arg_string == ' '; arg_string++ );
698 for( ; *arg_string && *arg_string != ' ' ; arg_string++ );
699 *arg_string++ = (char) 0;
702 error ("add-symbol-file takes a file name and an address");
704 text_addr = parse_and_eval_address (arg_string);
708 if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n",
709 name, local_hex_string (text_addr)))
710 error ("Not confirmed.");
712 symbol_file_add (name, 0, text_addr, 0);
715 /* Re-read symbols if the symbol-file has changed. */
721 /* With the addition of shared libraries, this should be modified,
722 the load time should be saved in the partial symbol tables, since
723 different tables may come from different source files. FIXME.
724 This routine should then walk down each partial symbol table
725 and see if the symbol table that it originates from has been changed
728 if (stat (symfile, &symstat) < 0)
729 /* Can't read symbol-file. Assume it is up to date. */
732 if (symstat.st_mtime > symfile_mtime)
734 printf_filtered ("Symbol file has changed; re-reading symbols.\n");
735 symbol_file_command (symfile, 0);
736 breakpoint_re_set ();
740 /* This function is really horrible, but to avoid it, there would need
741 to be more filling in of forward references. */
743 fill_in_vptr_fieldno (type)
746 if (TYPE_VPTR_FIELDNO (type) < 0)
749 for (i = 1; i < TYPE_N_BASECLASSES (type); i++)
751 fill_in_vptr_fieldno (TYPE_BASECLASS (type, i));
752 if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)) >= 0)
754 TYPE_VPTR_FIELDNO (type)
755 = TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i));
756 TYPE_VPTR_BASETYPE (type)
757 = TYPE_VPTR_BASETYPE (TYPE_BASECLASS (type, i));
764 /* Functions to handle complaints during symbol reading. */
766 /* How many complaints about a particular thing should be printed before
767 we stop whining about it? Default is no whining at all, since so many
768 systems have ill-constructed symbol files. */
770 static unsigned stop_whining = 0;
772 /* Print a complaint about the input symbols, and link the complaint block
773 into a chain for later handling. Result is 1 if the complaint was
774 printed, 0 if it was suppressed. */
777 complain (complaint, val)
778 struct complaint *complaint;
781 complaint->counter++;
782 if (complaint->next == 0) {
783 complaint->next = complaint_root->next;
784 complaint_root->next = complaint;
786 if (complaint->counter > stop_whining)
790 puts_filtered ("During symbol reading...");
792 printf_filtered (complaint->message, val);
793 puts_filtered ("...");
796 puts_filtered ("\n");
800 /* Clear out all complaint counters that have ever been incremented. */
807 for (p = complaint_root->next; p != complaint_root; p = p->next)
813 Allocate and partly initialize a new symbol table. Return a pointer
814 to it. error() if no space.
816 Caller must set these fields:
822 initialize any EXTRA_SYMTAB_INFO
823 possibly free_named_symtabs (symtab->filename);
824 symtab->next = symtab_list;
825 symtab_list = symtab;
829 allocate_symtab(name)
832 register struct symtab *symtab;
835 symtab = (struct symtab *) xmalloc (sizeof (struct symtab));
836 bzero (symtab, sizeof (*symtab));
837 symtab->filename = name;
838 symtab->fullname = NULL;
840 symtab->line_charpos = 0;
842 symtab->language = language_unknown; /* default */
844 c = rindex (name, '.');
847 ; /* Don't know language of file. */
848 } else if(!strcmp(c,".mod")) {
849 symtab->language = language_m2;
850 } else if(!strcmp(c,".c") || !strcmp(c,".cc")) {
851 symtab->language = language_c;
857 /* clear_symtab_users_once:
859 This function is run after symbol reading, or from a cleanup.
860 If an old symbol table was obsoleted, the old symbol table
861 has been blown away, but the other GDB data structures that may
862 reference it have not yet been cleared or re-directed. (The old
863 symtab was zapped, and the cleanup queued, in free_named_symtab()
866 This function can be queued N times as a cleanup, or called
867 directly; it will do all the work the first time, and then will be a
868 no-op until the next time it is queued. This works by bumping a
869 counter at queueing time. Much later when the cleanup is run, or at
870 the end of symbol processing (in case the cleanup is discarded), if
871 the queued count is greater than the "done-count", we do the work
872 and set the done-count to the queued count. If the queued count is
873 less than or equal to the done-count, we just ignore the call. This
874 is needed because reading a single .o file will often replace many
875 symtabs (one per .h file, for example), and we don't want to reset
876 the breakpoints N times in the user's face.
878 The reason we both queue a cleanup, and call it directly after symbol
879 reading, is because the cleanup protects us in case of errors, but is
880 discarded if symbol reading is successful. */
882 static int clear_symtab_users_queued;
883 static int clear_symtab_users_done;
886 clear_symtab_users_once ()
888 /* Enforce once-per-`do_cleanups'-semantics */
889 if (clear_symtab_users_queued <= clear_symtab_users_done)
891 clear_symtab_users_done = clear_symtab_users_queued;
893 printf ("Resetting debugger state after updating old symbol tables\n");
895 /* Someday, we should do better than this, by only blowing away
896 the things that really need to be blown. */
897 clear_value_history ();
899 clear_internalvars ();
900 breakpoint_re_set ();
901 set_default_breakpoint (0, 0, 0, 0);
902 current_source_symtab = 0;
905 /* Delete the specified psymtab, and any others that reference it. */
908 cashier_psymtab (pst)
909 struct partial_symtab *pst;
911 struct partial_symtab *ps, *pprev;
914 /* Find its previous psymtab in the chain */
915 for (ps = partial_symtab_list; ps; ps = ps->next) {
922 /* Unhook it from the chain. */
923 if (ps == partial_symtab_list)
924 partial_symtab_list = ps->next;
926 pprev->next = ps->next;
928 /* FIXME, we can't conveniently deallocate the entries in the
929 partial_symbol lists (global_psymbols/static_psymbols) that
930 this psymtab points to. These just take up space until all
931 the psymtabs are reclaimed. Ditto the dependencies list and
932 filename, which are all in the psymbol_obstack. */
934 /* We need to cashier any psymtab that has this one as a dependency... */
936 for (ps = partial_symtab_list; ps; ps = ps->next) {
937 for (i = 0; i < ps->number_of_dependencies; i++) {
938 if (ps->dependencies[i] == pst) {
939 cashier_psymtab (ps);
940 goto again; /* Must restart, chain has been munged. */
947 /* If a symtab or psymtab for filename NAME is found, free it along
948 with any dependent breakpoints, displays, etc.
949 Used when loading new versions of object modules with the "add-file"
950 command. This is only called on the top-level symtab or psymtab's name;
951 it is not called for subsidiary files such as .h files.
953 Return value is 1 if we blew away the environment, 0 if not.
955 FIXME. I think this is not the best way to do this. We should
956 work on being gentler to the environment while still cleaning up
957 all stray pointers into the freed symtab. */
960 free_named_symtabs (name)
963 register struct symtab *s;
964 register struct symtab *prev;
965 register struct partial_symtab *ps;
966 struct blockvector *bv;
969 /* We only wack things if the symbol-reload switch is set. */
970 if (!symbol_reloading)
973 /* Some symbol formats have trouble providing file names... */
974 if (name == 0 || *name == '\0')
977 /* Look for a psymtab with the specified name. */
980 for (ps = partial_symtab_list; ps; ps = ps->next) {
981 if (!strcmp (name, ps->filename)) {
982 cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
983 goto again2; /* Must restart, chain has been munged */
987 /* Look for a symtab with the specified name. */
989 for (s = symtab_list; s; s = s->next)
991 if (!strcmp (name, s->filename))
998 if (s == symtab_list)
999 symtab_list = s->next;
1001 prev->next = s->next;
1003 /* For now, queue a delete for all breakpoints, displays, etc., whether
1004 or not they depend on the symtab being freed. This should be
1005 changed so that only those data structures affected are deleted. */
1007 /* But don't delete anything if the symtab is empty.
1008 This test is necessary due to a bug in "dbxread.c" that
1009 causes empty symtabs to be created for N_SO symbols that
1010 contain the pathname of the object file. (This problem
1011 has been fixed in GDB 3.9x). */
1013 bv = BLOCKVECTOR (s);
1014 if (BLOCKVECTOR_NBLOCKS (bv) > 2
1015 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
1016 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)))
1018 complain (&oldsyms_complaint, name);
1020 clear_symtab_users_queued++;
1021 make_cleanup (clear_symtab_users_once, 0);
1024 complain (&empty_symtab_complaint, name);
1031 /* It is still possible that some breakpoints will be affected
1032 even though no symtab was found, since the file might have
1033 been compiled without debugging, and hence not be associated
1034 with a symtab. In order to handle this correctly, we would need
1035 to keep a list of text address ranges for undebuggable files.
1036 For now, we do nothing, since this is a fairly obscure case. */
1040 /* FIXME, what about the misc function vector? */
1045 _initialize_symfile ()
1048 add_com ("symbol-file", class_files, symbol_file_command,
1049 "Load symbol table from executable file FILE.\n\
1050 The `file' command can also load symbol tables, as well as setting the file\n\
1053 add_com ("add-symbol-file", class_files, add_symbol_file_command,
1054 "Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\
1055 The second argument provides the starting address of the file's text.");
1057 add_com ("load", class_files, load_command,
1058 "Dynamically load FILE into the running program, and record its symbols\n\
1059 for access from GDB.");
1062 (add_set_cmd ("complaints", class_support, var_uinteger,
1063 (char *)&stop_whining,
1064 "Set max number of complaints about incorrect symbols.",
1069 (add_set_cmd ("symbol-reloading", class_support, var_boolean,
1070 (char *)&symbol_reloading,
1071 "Set dynamic symbol table reloading multiple times in one run.",
1075 obstack_init (symbol_obstack);
1076 obstack_init (psymbol_obstack);