Oops! Retract last change. Didn't mean to pollute things with energize just
[deliverable/binutils-gdb.git] / gdb / symfile.c
CommitLineData
bd5635a1 1/* Generic symbol file reading for the GNU debugger, GDB.
30875e1c 2 Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
bd5635a1
RP
3 Contributed by Cygnus Support, using pieces from other GDB modules.
4
5This file is part of GDB.
6
61a7292f 7This program is free software; you can redistribute it and/or modify
bd5635a1 8it under the terms of the GNU General Public License as published by
61a7292f
SG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
bd5635a1 11
61a7292f 12This program is distributed in the hope that it will be useful,
bd5635a1
RP
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
61a7292f
SG
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 20
bd5635a1
RP
21#include "defs.h"
22#include "symtab.h"
30875e1c 23#include "gdbtypes.h"
bd5635a1
RP
24#include "gdbcore.h"
25#include "frame.h"
26#include "target.h"
27#include "value.h"
28#include "symfile.h"
bf349b77 29#include "objfiles.h"
bd5635a1
RP
30#include "gdbcmd.h"
31#include "breakpoint.h"
32
33#include <obstack.h>
34#include <assert.h>
35
36#include <sys/types.h>
37#include <fcntl.h>
38#include <string.h>
39#include <sys/stat.h>
9342ecb9 40#include <ctype.h>
bd5635a1 41
30875e1c
SG
42/* Global variables owned by this file */
43
80d68b1d 44int readnow_symbol_files; /* Read full symbols immediately */
d47d5315 45
30875e1c 46/* External variables and functions referenced. */
bd5635a1 47
30875e1c 48extern int info_verbose;
bd5635a1
RP
49
50/* Functions this file defines */
7d9884b9 51
30875e1c
SG
52static void
53load_command PARAMS ((char *, int));
54
55static void
56add_symbol_file_command PARAMS ((char *, int));
57
30875e1c
SG
58static void
59cashier_psymtab PARAMS ((struct partial_symtab *));
bd5635a1 60
30875e1c
SG
61static int
62compare_psymbols PARAMS ((const void *, const void *));
bd5635a1 63
30875e1c
SG
64static int
65compare_symbols PARAMS ((const void *, const void *));
66
b0246b3b
FF
67static bfd *
68symfile_bfd_open PARAMS ((char *));
30875e1c 69
80d68b1d
FF
70static void
71find_sym_fns PARAMS ((struct objfile *));
30875e1c 72
4ed3a9ea 73void
30875e1c 74clear_symtab_users_once PARAMS ((void));
bd5635a1 75
80d68b1d
FF
76/* List of all available sym_fns. On gdb startup, each object file reader
77 calls add_symtab_fns() to register information on each format it is
78 prepared to read. */
bd5635a1 79
80d68b1d 80static struct sym_fns *symtab_fns = NULL;
bd5635a1 81
bd5635a1
RP
82/* Structures with which to manage partial symbol allocation. */
83
84struct psymbol_allocation_list global_psymbols = {0}, static_psymbols = {0};
85
61a7292f
SG
86/* Flag for whether user will be reloading symbols multiple times.
87 Defaults to ON for VxWorks, otherwise OFF. */
88
89#ifdef SYMBOL_RELOADING_DEFAULT
90int symbol_reloading = SYMBOL_RELOADING_DEFAULT;
91#else
92int symbol_reloading = 0;
93#endif
94
bd5635a1
RP
95/* Structure to manage complaints about symbol file contents. */
96
97struct complaint complaint_root[1] = {
30875e1c 98 {(char *) 0, 0, complaint_root},
bd5635a1
RP
99};
100
9d199712
JG
101/* Some actual complaints. */
102
103struct complaint oldsyms_complaint = {
104 "Replacing old symbols for `%s'", 0, 0 };
105
106struct complaint empty_symtab_complaint = {
107 "Empty symbol table found for `%s'", 0, 0 };
108
bd5635a1
RP
109\f
110/* In the following sort, we always make sure that
111 register debug symbol declarations always come before regular
112 debug symbol declarations (as might happen when parameters are
30875e1c
SG
113 then put into registers by the compiler).
114
115 Since this function is called from within qsort, in an ANSI environment
116 it must conform to the prototype for qsort, which specifies that the
117 comparison function takes two "void *" pointers. */
bd5635a1
RP
118
119static int
30875e1c
SG
120compare_symbols (s1p, s2p)
121 const PTR s1p;
122 const PTR s2p;
bd5635a1 123{
30875e1c 124 register struct symbol **s1, **s2;
bd5635a1
RP
125 register int namediff;
126
30875e1c
SG
127 s1 = (struct symbol **) s1p;
128 s2 = (struct symbol **) s2p;
129
bd5635a1
RP
130 /* Compare the initial characters. */
131 namediff = SYMBOL_NAME (*s1)[0] - SYMBOL_NAME (*s2)[0];
132 if (namediff != 0) return namediff;
133
134 /* If they match, compare the rest of the names. */
135 namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
136 if (namediff != 0) return namediff;
137
138 /* For symbols of the same name, registers should come first. */
139 return ((SYMBOL_CLASS (*s2) == LOC_REGISTER)
140 - (SYMBOL_CLASS (*s1) == LOC_REGISTER));
141}
142
30875e1c
SG
143/*
144
145LOCAL FUNCTION
146
147 compare_psymbols -- compare two partial symbols by name
148
149DESCRIPTION
150
151 Given pointer to two partial symbol table entries, compare
152 them by name and return -N, 0, or +N (ala strcmp). Typically
153 used by sorting routines like qsort().
154
155NOTES
156
157 Does direct compare of first two characters before punting
158 and passing to strcmp for longer compares. Note that the
159 original version had a bug whereby two null strings or two
160 identically named one character strings would return the
161 comparison of memory following the null byte.
162
163 */
164
165static int
166compare_psymbols (s1p, s2p)
167 const PTR s1p;
168 const PTR s2p;
169{
170 register char *st1 = SYMBOL_NAME ((struct partial_symbol *) s1p);
171 register char *st2 = SYMBOL_NAME ((struct partial_symbol *) s2p);
172
173 if ((st1[0] - st2[0]) || !st1[0])
174 {
175 return (st1[0] - st2[0]);
176 }
177 else if ((st1[1] - st2[1]) || !st1[1])
178 {
179 return (st1[1] - st2[1]);
180 }
181 else
182 {
183 return (strcmp (st1 + 2, st2 + 2));
184 }
185}
186
187void
188sort_pst_symbols (pst)
189 struct partial_symtab *pst;
190{
191 /* Sort the global list; don't sort the static list */
192
193 qsort (pst -> objfile -> global_psymbols.list + pst -> globals_offset,
194 pst -> n_global_syms, sizeof (struct partial_symbol),
195 compare_psymbols);
196}
197
bd5635a1
RP
198/* Call sort_block_syms to sort alphabetically the symbols of one block. */
199
200void
201sort_block_syms (b)
202 register struct block *b;
203{
204 qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
205 sizeof (struct symbol *), compare_symbols);
206}
207
208/* Call sort_symtab_syms to sort alphabetically
209 the symbols of each block of one symtab. */
210
211void
212sort_symtab_syms (s)
213 register struct symtab *s;
214{
c9bd6710
JG
215 register struct blockvector *bv;
216 int nbl;
bd5635a1
RP
217 int i;
218 register struct block *b;
219
c9bd6710
JG
220 if (s == 0)
221 return;
222 bv = BLOCKVECTOR (s);
223 nbl = BLOCKVECTOR_NBLOCKS (bv);
bd5635a1
RP
224 for (i = 0; i < nbl; i++)
225 {
226 b = BLOCKVECTOR_BLOCK (bv, i);
227 if (BLOCK_SHOULD_SORT (b))
228 sort_block_syms (b);
229 }
230}
231
232void
233sort_all_symtab_syms ()
234{
235 register struct symtab *s;
30875e1c 236 register struct objfile *objfile;
bd5635a1 237
30875e1c 238 for (objfile = object_files; objfile != NULL; objfile = objfile -> next)
bd5635a1 239 {
30875e1c
SG
240 for (s = objfile -> symtabs; s != NULL; s = s -> next)
241 {
242 sort_symtab_syms (s);
243 }
bd5635a1
RP
244 }
245}
246
247/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
248 (and add a null character at the end in the copy).
249 Returns the address of the copy. */
250
251char *
30875e1c 252obsavestring (ptr, size, obstackp)
bd5635a1
RP
253 char *ptr;
254 int size;
30875e1c 255 struct obstack *obstackp;
bd5635a1 256{
30875e1c 257 register char *p = (char *) obstack_alloc (obstackp, size + 1);
bd5635a1
RP
258 /* Open-coded bcopy--saves function call time.
259 These strings are usually short. */
260 {
261 register char *p1 = ptr;
262 register char *p2 = p;
263 char *end = ptr + size;
264 while (p1 != end)
265 *p2++ = *p1++;
266 }
267 p[size] = 0;
268 return p;
269}
270
271/* Concatenate strings S1, S2 and S3; return the new string.
272 Space is found in the symbol_obstack. */
273
274char *
30875e1c
SG
275obconcat (obstackp, s1, s2, s3)
276 struct obstack *obstackp;
277 const char *s1, *s2, *s3;
bd5635a1
RP
278{
279 register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
30875e1c 280 register char *val = (char *) obstack_alloc (obstackp, len);
bd5635a1
RP
281 strcpy (val, s1);
282 strcat (val, s2);
283 strcat (val, s3);
284 return val;
285}
bd5635a1
RP
286
287/* Get the symbol table that corresponds to a partial_symtab.
288 This is fast after the first time you do it. In fact, there
289 is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
290 case inline. */
291
292struct symtab *
293psymtab_to_symtab (pst)
294 register struct partial_symtab *pst;
295{
bd5635a1
RP
296 /* If it's been looked up before, return it. */
297 if (pst->symtab)
298 return pst->symtab;
299
300 /* If it has not yet been read in, read it. */
301 if (!pst->readin)
302 {
303 (*pst->read_symtab) (pst);
304 }
305
61a7292f 306 return pst->symtab;
bd5635a1
RP
307}
308
bf349b77
FF
309/* Initialize entry point information for this objfile. */
310
311void
312init_entry_point_info (objfile)
313 struct objfile *objfile;
314{
315 /* Save startup file's range of PC addresses to help blockframe.c
316 decide where the bottom of the stack is. */
317
318 if (bfd_get_file_flags (objfile -> obfd) & EXEC_P)
319 {
320 /* Executable file -- record its entry point so we'll recognize
321 the startup file because it contains the entry point. */
322 objfile -> ei.entry_point = bfd_get_start_address (objfile -> obfd);
323 }
324 else
325 {
326 /* Examination of non-executable.o files. Short-circuit this stuff. */
327 /* ~0 will not be in any file, we hope. */
328 objfile -> ei.entry_point = ~0;
329 /* set the startup file to be an empty range. */
330 objfile -> ei.entry_file_lowpc = 0;
331 objfile -> ei.entry_file_highpc = 0;
332 }
333}
334
bd5635a1
RP
335/* Process a symbol file, as either the main file or as a dynamically
336 loaded file.
337
b3fdaf3d
JK
338 NAME is the file name (which will be tilde-expanded and made
339 absolute herein) (but we don't free or modify NAME itself).
340 FROM_TTY says how verbose to be. MAINLINE specifies whether this
341 is the main symbol file, or whether it's an extra symbol file such
342 as dynamically loaded code. If !mainline, ADDR is the address
4369a140
JG
343 where the text segment was loaded. If VERBO, the caller has printed
344 a verbose message about the symbol reading (and complaints can be
345 more terse about it). */
bd5635a1
RP
346
347void
4369a140 348syms_from_objfile (objfile, addr, mainline, verbo)
7d9884b9 349 struct objfile *objfile;
bd5635a1
RP
350 CORE_ADDR addr;
351 int mainline;
4369a140 352 int verbo;
bd5635a1 353{
bd5635a1 354 asection *text_sect;
bd5635a1 355
bd5635a1
RP
356 /* There is a distinction between having no symbol table
357 (we refuse to read the file, leaving the old set of symbols around)
358 and having no debugging symbols in your symbol table (we read
bf349b77
FF
359 the file and end up with a mostly empty symbol table).
360
361 FIXME: This strategy works correctly when the debugging symbols are
362 intermixed with "normal" symbols. However, when the debugging symbols
363 are separate, such as with ELF/DWARF, it is perfectly plausible for
364 the symbol table to be missing but still have all the DWARF info
365 intact. Thus in general it is wrong to assume that having no symbol
366 table implies no debugging information. */
bd5635a1 367
b0246b3b 368 if (!(bfd_get_file_flags (objfile -> obfd) & HAS_SYMS))
d47d5315
JG
369 return;
370
bf349b77 371 init_entry_point_info (objfile);
80d68b1d 372 find_sym_fns (objfile);
bd5635a1
RP
373
374 if (mainline)
375 {
376 /* Since no error yet, throw away the old symbol table. */
377
80d68b1d
FF
378 if (symfile_objfile != NULL)
379 {
380 free_objfile (symfile_objfile);
381 symfile_objfile = NULL;
382 }
bd5635a1 383
80d68b1d 384 (*objfile -> sf -> sym_new_init) (objfile);
bd5635a1
RP
385
386 /* For mainline, caller didn't know the specified address of the
387 text section. We fix that here. */
80d68b1d 388
b0246b3b
FF
389 text_sect = bfd_get_section_by_name (objfile -> obfd, ".text");
390 addr = bfd_section_vma (objfile -> obfd, text_sect);
bd5635a1
RP
391 }
392
80d68b1d
FF
393 /* Initialize symbol reading routines for this objfile, allow complaints to
394 appear for this new file, and record how verbose to be, then do the
395 initial symbol reading for this file. */
4369a140 396
80d68b1d
FF
397 (*objfile -> sf -> sym_init) (objfile);
398 clear_complaints (1, verbo);
399 (*objfile -> sf -> sym_read) (objfile, addr, mainline);
bd5635a1
RP
400
401 /* Don't allow char * to have a typename (else would get caddr_t.) */
402 /* Ditto void *. FIXME should do this for all the builtin types. */
403
404 TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
405 TYPE_NAME (lookup_pointer_type (builtin_type_void)) = 0;
406
9342ecb9
JG
407 /* Mark the objfile has having had initial symbol read attempted. Note
408 that this does not mean we found any symbols... */
409
410 objfile -> flags |= OBJF_SYMS;
411}
412
413/* Perform required actions immediately after either reading in the initial
414 symbols for a new objfile, or mapping in the symbols from a reusable
415 objfile. */
416
417void
418new_symfile_objfile (objfile, mainline, verbo)
419 struct objfile *objfile;
420 int mainline;
421 int verbo;
422{
bd5635a1
RP
423 if (mainline)
424 {
425 /* OK, make it the "real" symbol file. */
7d9884b9 426 symfile_objfile = objfile;
bd5635a1
RP
427 }
428
0ef6f019
JG
429 /* If we have wiped out any old symbol tables, clean up. */
430 clear_symtab_users_once ();
4369a140
JG
431
432 /* We're done reading the symbol file; finish off complaints. */
80d68b1d 433 clear_complaints (0, verbo);
30875e1c 434
318bf84f
FF
435 /* Fixup all the breakpoints that may have been redefined by this
436 symbol file. */
30875e1c 437
318bf84f 438 breakpoint_re_set ();
30875e1c 439}
d47d5315
JG
440
441/* Process a symbol file, as either the main file or as a dynamically
442 loaded file.
443
444 NAME is the file name (which will be tilde-expanded and made
445 absolute herein) (but we don't free or modify NAME itself).
446 FROM_TTY says how verbose to be. MAINLINE specifies whether this
447 is the main symbol file, or whether it's an extra symbol file such
448 as dynamically loaded code. If !mainline, ADDR is the address
30875e1c 449 where the text segment was loaded.
d47d5315 450
30875e1c
SG
451 Upon success, returns a pointer to the objfile that was added.
452 Upon failure, jumps back to command level (never returns). */
453
454struct objfile *
b0246b3b 455symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
d47d5315
JG
456 char *name;
457 int from_tty;
458 CORE_ADDR addr;
459 int mainline;
318bf84f 460 int mapped;
b0246b3b 461 int readnow;
d47d5315 462{
7d9884b9 463 struct objfile *objfile;
b0246b3b 464 struct partial_symtab *psymtab;
80d68b1d 465 bfd *abfd;
d47d5315 466
80d68b1d
FF
467 /* Open a bfd for the file and then check to see if the file has a
468 symbol table. There is a distinction between having no symbol table
d47d5315 469 (we refuse to read the file, leaving the old set of symbols around)
80d68b1d
FF
470 and having no debugging symbols in the symbol table (we read the file
471 and end up with a mostly empty symbol table, but with lots of stuff in
472 the minimal symbol table). We need to make the decision about whether
473 to continue with the file before allocating and building a objfile.
474
475 FIXME: This strategy works correctly when the debugging symbols are
476 intermixed with "normal" symbols. However, when the debugging symbols
477 are separate, such as with ELF/DWARF, it is perfectly plausible for
478 the symbol table to be missing but still have all the DWARF info
479 intact. Thus in general it is wrong to assume that having no symbol
480 table implies no debugging information. */
481
482 abfd = symfile_bfd_open (name);
483 if (!(bfd_get_file_flags (abfd) & HAS_SYMS))
d47d5315
JG
484 {
485 error ("%s has no symbol-table", name);
486 }
487
80d68b1d
FF
488 if ((have_full_symbols () || have_partial_symbols ())
489 && mainline
490 && from_tty
491 && !query ("Load new symbol table from \"%s\"? ", name))
492 error ("Not confirmed.");
493
494 objfile = allocate_objfile (abfd, mapped);
495
318bf84f
FF
496 /* If the objfile uses a mapped symbol file, and we have a psymtab for
497 it, then skip reading any symbols at this time. */
d47d5315 498
bf349b77 499 if ((objfile -> flags & OBJF_MAPPED) && (objfile -> flags & OBJF_SYMS))
d47d5315 500 {
80d68b1d 501 /* We mapped in an existing symbol table file that already has had
bf349b77
FF
502 initial symbol reading performed, so we can skip that part. Notify
503 the user that instead of reading the symbols, they have been mapped.
504 */
318bf84f
FF
505 if (from_tty || info_verbose)
506 {
80d68b1d
FF
507 printf_filtered ("Mapped symbols for %s...", name);
508 wrap_here ("");
318bf84f
FF
509 fflush (stdout);
510 }
9342ecb9
JG
511 init_entry_point_info (objfile);
512 find_sym_fns (objfile);
d47d5315 513 }
318bf84f 514 else
bd5635a1 515 {
80d68b1d 516 /* We either created a new mapped symbol table, mapped an existing
bf349b77
FF
517 symbol table file which has not had initial symbol reading
518 performed, or need to read an unmapped symbol table. */
318bf84f
FF
519 if (from_tty || info_verbose)
520 {
521 printf_filtered ("Reading symbols from %s...", name);
522 wrap_here ("");
523 fflush (stdout);
524 }
318bf84f 525 syms_from_objfile (objfile, addr, mainline, from_tty);
80d68b1d
FF
526 }
527
9342ecb9
JG
528 new_symfile_objfile (objfile, mainline, from_tty);
529
80d68b1d
FF
530 /* We now have at least a partial symbol table. Check to see if the
531 user requested that all symbols be read on initial access via either
532 the gdb startup command line or on a per symbol file basis. Expand
533 all partial symbol tables for this objfile if so. */
b0246b3b 534
bf349b77 535 if (readnow || readnow_symbol_files)
80d68b1d 536 {
318bf84f
FF
537 if (from_tty || info_verbose)
538 {
80d68b1d
FF
539 printf_filtered ("expanding to full symbols...");
540 wrap_here ("");
318bf84f
FF
541 fflush (stdout);
542 }
80d68b1d
FF
543
544 for (psymtab = objfile -> psymtabs;
545 psymtab != NULL;
546 psymtab = psymtab -> next)
547 {
4ed3a9ea 548 psymtab_to_symtab (psymtab);
80d68b1d
FF
549 }
550 }
551
552 if (from_tty || info_verbose)
553 {
554 printf_filtered ("done.\n");
555 fflush (stdout);
bd5635a1 556 }
80d68b1d 557
30875e1c 558 return (objfile);
bd5635a1
RP
559}
560
561/* This is the symbol-file command. Read the file, analyze its symbols,
30875e1c 562 and add a struct symtab to a symtab list. */
bd5635a1
RP
563
564void
30875e1c
SG
565symbol_file_command (args, from_tty)
566 char *args;
bd5635a1
RP
567 int from_tty;
568{
30875e1c 569 char **argv;
b0246b3b 570 char *name = NULL;
30875e1c 571 struct cleanup *cleanups;
318bf84f 572 int mapped = 0;
30875e1c 573 int readnow = 0;
bd5635a1
RP
574
575 dont_repeat ();
576
30875e1c 577 if (args == NULL)
bd5635a1 578 {
cba0d141
JG
579 if ((have_full_symbols () || have_partial_symbols ())
580 && from_tty
581 && !query ("Discard symbol table from `%s'? ",
582 symfile_objfile -> name))
583 error ("Not confirmed.");
584 free_all_objfiles ();
30875e1c 585 symfile_objfile = NULL;
9342ecb9
JG
586 if (from_tty)
587 {
588 printf ("No symbol file now.\n");
589 }
bd5635a1 590 }
30875e1c
SG
591 else
592 {
593 if ((argv = buildargv (args)) == NULL)
594 {
318bf84f 595 nomem (0);
30875e1c
SG
596 }
597 cleanups = make_cleanup (freeargv, (char *) argv);
b0246b3b 598 while (*argv != NULL)
30875e1c 599 {
b0246b3b 600 if (strcmp (*argv, "-mapped") == 0)
30875e1c 601 {
318bf84f 602 mapped = 1;
30875e1c 603 }
b0246b3b 604 else if (strcmp (*argv, "-readnow") == 0)
30875e1c
SG
605 {
606 readnow = 1;
607 }
b0246b3b
FF
608 else if (**argv == '-')
609 {
610 error ("unknown option `%s'", *argv);
611 }
612 else
613 {
614 name = *argv;
615 }
616 argv++;
30875e1c 617 }
2403f49b 618
b0246b3b
FF
619 if (name == NULL)
620 {
621 error ("no symbol file name was specified");
622 }
623 else
30875e1c 624 {
318bf84f
FF
625 /* Getting new symbols may change our opinion about what is
626 frameless. */
627 reinit_frame_cache ();
4ed3a9ea 628 symbol_file_add (name, from_tty, (CORE_ADDR)0, 1, mapped, readnow);
30875e1c
SG
629 }
630 do_cleanups (cleanups);
631 }
bd5635a1
RP
632}
633
b0246b3b
FF
634/* Open file specified by NAME and hand it off to BFD for preliminary
635 analysis. Result is a newly initialized bfd *, which includes a newly
636 malloc'd` copy of NAME (tilde-expanded and made absolute).
7d9884b9 637 In case of trouble, error() is called. */
bd5635a1 638
b0246b3b
FF
639static bfd *
640symfile_bfd_open (name)
bd5635a1
RP
641 char *name;
642{
643 bfd *sym_bfd;
644 int desc;
645 char *absolute_name;
646
7d9884b9 647 name = tilde_expand (name); /* Returns 1st new malloc'd copy */
bd5635a1 648
7d9884b9 649 /* Look down path for it, allocate 2nd new malloc'd copy. */
bd5635a1 650 desc = openp (getenv ("PATH"), 1, name, O_RDONLY, 0, &absolute_name);
b0246b3b
FF
651 if (desc < 0)
652 {
653 make_cleanup (free, name);
654 perror_with_name (name);
655 }
7d9884b9 656 free (name); /* Free 1st new malloc'd copy */
30875e1c 657 name = absolute_name; /* Keep 2nd malloc'd copy in bfd */
346168a2 658 /* It'll be freed in free_objfile(). */
bd5635a1
RP
659
660 sym_bfd = bfd_fdopenr (name, NULL, desc);
661 if (!sym_bfd)
662 {
663 close (desc);
7d9884b9 664 make_cleanup (free, name);
b0246b3b
FF
665 error ("\"%s\": can't open to read symbols: %s.", name,
666 bfd_errmsg (bfd_error));
bd5635a1 667 }
bd5635a1 668
b0246b3b
FF
669 if (!bfd_check_format (sym_bfd, bfd_object))
670 {
671 bfd_close (sym_bfd); /* This also closes desc */
672 make_cleanup (free, name);
673 error ("\"%s\": can't read symbols: %s.", name,
674 bfd_errmsg (bfd_error));
675 }
7d9884b9 676
b0246b3b 677 return (sym_bfd);
7d9884b9
JG
678}
679
80d68b1d
FF
680/* Link a new symtab_fns into the global symtab_fns list. Called on gdb
681 startup by the _initialize routine in each object file format reader,
682 to register information about each format the the reader is prepared
683 to handle. */
bd5635a1
RP
684
685void
686add_symtab_fns (sf)
687 struct sym_fns *sf;
688{
689 sf->next = symtab_fns;
690 symtab_fns = sf;
691}
692
693
694/* Initialize to read symbols from the symbol file sym_bfd. It either
80d68b1d
FF
695 returns or calls error(). The result is an initialized struct sym_fns
696 in the objfile structure, that contains cached information about the
697 symbol file. */
bd5635a1 698
80d68b1d
FF
699static void
700find_sym_fns (objfile)
7d9884b9 701 struct objfile *objfile;
bd5635a1 702{
ac88ca20 703 struct sym_fns *sf;
bd5635a1 704
80d68b1d 705 for (sf = symtab_fns; sf != NULL; sf = sf -> next)
bd5635a1 706 {
80d68b1d
FF
707 if (strncmp (bfd_get_target (objfile -> obfd),
708 sf -> sym_name, sf -> sym_namelen) == 0)
bd5635a1 709 {
80d68b1d
FF
710 objfile -> sf = sf;
711 return;
bd5635a1
RP
712 }
713 }
c9bd6710 714 error ("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown.",
b0246b3b 715 bfd_get_target (objfile -> obfd));
bd5635a1
RP
716}
717\f
718/* This function runs the load command of our current target. */
719
30875e1c 720static void
bd5635a1
RP
721load_command (arg, from_tty)
722 char *arg;
723 int from_tty;
724{
725 target_load (arg, from_tty);
726}
727
61a7292f
SG
728/* This function allows the addition of incrementally linked object files.
729 It does not modify any state in the target, only in the debugger. */
bd5635a1 730
e1ce8aa5 731/* ARGSUSED */
30875e1c 732static void
b0246b3b
FF
733add_symbol_file_command (args, from_tty)
734 char *args;
bd5635a1
RP
735 int from_tty;
736{
b0246b3b 737 char *name = NULL;
bd5635a1 738 CORE_ADDR text_addr;
b0246b3b 739 char *arg;
ac88ca20
JG
740 int readnow = 0;
741 int mapped = 0;
bd5635a1 742
b0246b3b 743 dont_repeat ();
61a7292f 744
b0246b3b
FF
745 if (args == NULL)
746 {
747 error ("add-symbol-file takes a file name and an address");
748 }
bd5635a1 749
b0246b3b 750 /* Make a copy of the string that we can safely write into. */
bd5635a1 751
b0246b3b
FF
752 args = strdup (args);
753 make_cleanup (free, args);
754
755 /* Pick off any -option args and the file name. */
756
757 while ((*args != '\000') && (name == NULL))
758 {
759 while (isspace (*args)) {args++;}
760 arg = args;
761 while ((*args != '\000') && !isspace (*args)) {args++;}
762 if (*args != '\000')
763 {
764 *args++ = '\000';
765 }
766 if (*arg != '-')
767 {
768 name = arg;
769 }
770 else if (strcmp (arg, "-mapped") == 0)
771 {
772 mapped = 1;
773 }
774 else if (strcmp (arg, "-readnow") == 0)
775 {
776 readnow = 1;
777 }
778 else
779 {
780 error ("unknown option `%s'", arg);
781 }
782 }
bd5635a1 783
b0246b3b
FF
784 /* After picking off any options and the file name, args should be
785 left pointing at the remainder of the command line, which should
786 be the address expression to evaluate. */
bd5635a1 787
b0246b3b
FF
788 if ((name == NULL) || (*args == '\000') )
789 {
790 error ("add-symbol-file takes a file name and an address");
791 }
792 name = tilde_expand (name);
793 make_cleanup (free, name);
bd5635a1 794
b0246b3b 795 text_addr = parse_and_eval_address (args);
bd5635a1 796
d8ce1326
JG
797 if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n",
798 name, local_hex_string (text_addr)))
bd5635a1
RP
799 error ("Not confirmed.");
800
b0246b3b
FF
801 /* Getting new symbols may change our opinion about what is
802 frameless. */
803
804 reinit_frame_cache ();
805
4ed3a9ea 806 symbol_file_add (name, 0, text_addr, 0, mapped, readnow);
bd5635a1
RP
807}
808\f
7d9884b9 809/* Re-read symbols if a symbol-file has changed. */
bd5635a1
RP
810void
811reread_symbols ()
812{
7d9884b9
JG
813 struct objfile *objfile;
814 long new_modtime;
815 int reread_one = 0;
cba0d141
JG
816 struct stat new_statbuf;
817 int res;
bd5635a1
RP
818
819 /* With the addition of shared libraries, this should be modified,
820 the load time should be saved in the partial symbol tables, since
821 different tables may come from different source files. FIXME.
822 This routine should then walk down each partial symbol table
30875e1c 823 and see if the symbol table that it originates from has been changed */
bd5635a1 824
30875e1c 825the_big_top:
7d9884b9
JG
826 for (objfile = object_files; objfile; objfile = objfile->next) {
827 if (objfile->obfd) {
1eeba686 828#ifdef IBM6000_TARGET
318bf84f
FF
829 /* If this object is from a shared library, then you should
830 stat on the library name, not member name. */
831
832 if (objfile->obfd->my_archive)
833 res = stat (objfile->obfd->my_archive->filename, &new_statbuf);
834 else
835#endif
cba0d141
JG
836 res = stat (objfile->name, &new_statbuf);
837 if (res != 0) {
838 /* FIXME, should use print_sys_errmsg but it's not filtered. */
839 printf_filtered ("`%s' has disappeared; keeping its symbols.\n",
840 objfile->name);
841 continue;
842 }
843 new_modtime = new_statbuf.st_mtime;
7d9884b9
JG
844 if (new_modtime != objfile->mtime) {
845 printf_filtered ("`%s' has changed; re-reading symbols.\n",
846 objfile->name);
847 /* FIXME, this should use a different command...that would only
30875e1c
SG
848 affect this objfile's symbols, and would reset objfile->mtime.
849 (objfile->mtime = new_modtime;)
850 HOWEVER, that command isn't written yet -- so call symbol_file_
851 command, and restart the scan from the top, because it munges
852 the object_files list. */
7d9884b9 853 symbol_file_command (objfile->name, 0);
7d9884b9 854 reread_one = 1;
30875e1c 855 goto the_big_top; /* Start over. */
7d9884b9 856 }
bd5635a1 857 }
7d9884b9
JG
858 }
859
860 if (reread_one)
861 breakpoint_re_set ();
bd5635a1 862}
bd5635a1
RP
863\f
864/* Functions to handle complaints during symbol reading. */
865
866/* How many complaints about a particular thing should be printed before
61a7292f
SG
867 we stop whining about it? Default is no whining at all, since so many
868 systems have ill-constructed symbol files. */
bd5635a1 869
61a7292f 870static unsigned stop_whining = 0;
bd5635a1 871
4369a140
JG
872/* Should each complaint be self explanatory, or should we assume that
873 a series of complaints is being produced?
874 case 0: self explanatory message.
875 case 1: First message of a series that must start off with explanation.
876 case 2: Subsequent message, when user already knows we are reading
877 symbols and we can just state our piece. */
878
879static int complaint_series = 0;
880
bd5635a1 881/* Print a complaint about the input symbols, and link the complaint block
7d9884b9 882 into a chain for later handling. */
bd5635a1 883
7d9884b9 884void
bd5635a1
RP
885complain (complaint, val)
886 struct complaint *complaint;
887 char *val;
888{
889 complaint->counter++;
890 if (complaint->next == 0) {
891 complaint->next = complaint_root->next;
892 complaint_root->next = complaint;
893 }
894 if (complaint->counter > stop_whining)
7d9884b9 895 return;
bd5635a1 896 wrap_here ("");
4369a140
JG
897
898 switch (complaint_series + (info_verbose << 1)) {
899
900 /* Isolated messages, must be self-explanatory. */
901 case 0:
902 puts_filtered ("During symbol reading, ");
903 wrap_here("");
904 printf_filtered (complaint->message, val);
905 puts_filtered (".\n");
906 break;
907
908 /* First of a series, without `set verbose'. */
909 case 1:
bd5635a1 910 puts_filtered ("During symbol reading...");
4369a140
JG
911 printf_filtered (complaint->message, val);
912 puts_filtered ("...");
913 wrap_here("");
914 complaint_series++;
915 break;
916
917 /* Subsequent messages of a series, or messages under `set verbose'.
918 (We'll already have produced a "Reading in symbols for XXX..." message
919 and will clean up at the end with a newline.) */
920 default:
921 printf_filtered (complaint->message, val);
922 puts_filtered ("...");
923 wrap_here("");
bd5635a1 924 }
bd5635a1
RP
925}
926
4369a140
JG
927/* Clear out all complaint counters that have ever been incremented.
928 If sym_reading is 1, be less verbose about successive complaints,
929 since the messages are appearing all together during a command that
930 reads symbols (rather than scattered around as psymtabs get fleshed
931 out into symtabs at random times). If noisy is 1, we are in a
932 noisy symbol reading command, and our caller will print enough
933 context for the user to figure it out. */
bd5635a1
RP
934
935void
4369a140
JG
936clear_complaints (sym_reading, noisy)
937 int sym_reading;
938 int noisy;
bd5635a1
RP
939{
940 struct complaint *p;
941
942 for (p = complaint_root->next; p != complaint_root; p = p->next)
943 p->counter = 0;
4369a140
JG
944
945 if (!sym_reading && !noisy && complaint_series > 1) {
946 /* Terminate previous series, since caller won't. */
947 puts_filtered ("\n");
948 }
949
950 complaint_series = sym_reading? 1 + noisy: 0;
bd5635a1
RP
951}
952\f
7d9884b9
JG
953enum language
954deduce_language_from_filename (filename)
955 char *filename;
956{
30875e1c 957 char *c = strrchr (filename, '.');
7d9884b9
JG
958
959 if (!c) ; /* Get default. */
960 else if(!strcmp(c,".mod"))
961 return language_m2;
962 else if(!strcmp(c,".c"))
963 return language_c;
964 else if(!strcmp(c,".cc") || !strcmp(c,".C"))
965 return language_cplus;
966
967 return language_unknown; /* default */
968}
969\f
d8ce1326
JG
970/* allocate_symtab:
971
972 Allocate and partly initialize a new symbol table. Return a pointer
973 to it. error() if no space.
974
975 Caller must set these fields:
976 LINETABLE(symtab)
977 symtab->blockvector
d8ce1326
JG
978 symtab->dirname
979 symtab->free_code
980 symtab->free_ptr
981 initialize any EXTRA_SYMTAB_INFO
982 possibly free_named_symtabs (symtab->filename);
d8ce1326
JG
983 */
984
985struct symtab *
30875e1c
SG
986allocate_symtab (filename, objfile)
987 char *filename;
988 struct objfile *objfile;
d8ce1326
JG
989{
990 register struct symtab *symtab;
d8ce1326 991
30875e1c
SG
992 symtab = (struct symtab *)
993 obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symtab));
4ed3a9ea 994 memset (symtab, 0, sizeof (*symtab));
30875e1c
SG
995 symtab -> filename = obsavestring (filename, strlen (filename),
996 &objfile -> symbol_obstack);
997 symtab -> fullname = NULL;
998 symtab -> language = deduce_language_from_filename (filename);
d8ce1326 999
7d9884b9 1000 /* Hook it to the objfile it comes from */
30875e1c
SG
1001
1002 symtab -> objfile = objfile;
1003 symtab -> next = objfile -> symtabs;
1004 objfile -> symtabs = symtab;
7d9884b9
JG
1005
1006#ifdef INIT_EXTRA_SYMTAB_INFO
30875e1c 1007 INIT_EXTRA_SYMTAB_INFO (symtab);
7d9884b9 1008#endif
d8ce1326 1009
30875e1c 1010 return (symtab);
d8ce1326 1011}
30875e1c
SG
1012
1013struct partial_symtab *
1014allocate_psymtab (filename, objfile)
1015 char *filename;
1016 struct objfile *objfile;
1017{
1018 struct partial_symtab *psymtab;
1019
cba0d141
JG
1020 if (objfile -> free_psymtabs)
1021 {
1022 psymtab = objfile -> free_psymtabs;
1023 objfile -> free_psymtabs = psymtab -> next;
1024 }
1025 else
1026 psymtab = (struct partial_symtab *)
1027 obstack_alloc (&objfile -> psymbol_obstack,
1028 sizeof (struct partial_symtab));
1029
4ed3a9ea 1030 memset (psymtab, 0, sizeof (struct partial_symtab));
30875e1c
SG
1031 psymtab -> filename = obsavestring (filename, strlen (filename),
1032 &objfile -> psymbol_obstack);
1033 psymtab -> symtab = NULL;
1034
1035 /* Hook it to the objfile it comes from */
1036
1037 psymtab -> objfile = objfile;
1038 psymtab -> next = objfile -> psymtabs;
1039 objfile -> psymtabs = psymtab;
1040
1041 return (psymtab);
1042}
1043
d8ce1326 1044\f
9d199712
JG
1045/* clear_symtab_users_once:
1046
1047 This function is run after symbol reading, or from a cleanup.
1048 If an old symbol table was obsoleted, the old symbol table
1049 has been blown away, but the other GDB data structures that may
1050 reference it have not yet been cleared or re-directed. (The old
1051 symtab was zapped, and the cleanup queued, in free_named_symtab()
1052 below.)
1053
1054 This function can be queued N times as a cleanup, or called
1055 directly; it will do all the work the first time, and then will be a
1056 no-op until the next time it is queued. This works by bumping a
1057 counter at queueing time. Much later when the cleanup is run, or at
1058 the end of symbol processing (in case the cleanup is discarded), if
1059 the queued count is greater than the "done-count", we do the work
1060 and set the done-count to the queued count. If the queued count is
1061 less than or equal to the done-count, we just ignore the call. This
1062 is needed because reading a single .o file will often replace many
1063 symtabs (one per .h file, for example), and we don't want to reset
1064 the breakpoints N times in the user's face.
1065
1066 The reason we both queue a cleanup, and call it directly after symbol
1067 reading, is because the cleanup protects us in case of errors, but is
1068 discarded if symbol reading is successful. */
1069
1070static int clear_symtab_users_queued;
1071static int clear_symtab_users_done;
1072
4ed3a9ea 1073void
9d199712
JG
1074clear_symtab_users_once ()
1075{
1076 /* Enforce once-per-`do_cleanups'-semantics */
1077 if (clear_symtab_users_queued <= clear_symtab_users_done)
1078 return;
1079 clear_symtab_users_done = clear_symtab_users_queued;
1080
1081 printf ("Resetting debugger state after updating old symbol tables\n");
1082
1083 /* Someday, we should do better than this, by only blowing away
1084 the things that really need to be blown. */
1085 clear_value_history ();
1086 clear_displays ();
1087 clear_internalvars ();
1088 breakpoint_re_set ();
1089 set_default_breakpoint (0, 0, 0, 0);
1090 current_source_symtab = 0;
1091}
1092
1093/* Delete the specified psymtab, and any others that reference it. */
1094
e1ce8aa5 1095static void
9d199712
JG
1096cashier_psymtab (pst)
1097 struct partial_symtab *pst;
1098{
1099 struct partial_symtab *ps, *pprev;
1100 int i;
1101
1102 /* Find its previous psymtab in the chain */
30875e1c 1103 for (ps = pst->objfile->psymtabs; ps; ps = ps->next) {
9d199712
JG
1104 if (ps == pst)
1105 break;
1106 pprev = ps;
1107 }
1108
1109 if (ps) {
1110 /* Unhook it from the chain. */
30875e1c
SG
1111 if (ps == pst->objfile->psymtabs)
1112 pst->objfile->psymtabs = ps->next;
9d199712
JG
1113 else
1114 pprev->next = ps->next;
1115
1116 /* FIXME, we can't conveniently deallocate the entries in the
1117 partial_symbol lists (global_psymbols/static_psymbols) that
1118 this psymtab points to. These just take up space until all
1119 the psymtabs are reclaimed. Ditto the dependencies list and
1120 filename, which are all in the psymbol_obstack. */
1121
1122 /* We need to cashier any psymtab that has this one as a dependency... */
1123again:
30875e1c 1124 for (ps = pst->objfile->psymtabs; ps; ps = ps->next) {
9d199712
JG
1125 for (i = 0; i < ps->number_of_dependencies; i++) {
1126 if (ps->dependencies[i] == pst) {
1127 cashier_psymtab (ps);
1128 goto again; /* Must restart, chain has been munged. */
1129 }
1130 }
1131 }
1132 }
1133}
1134
1135/* If a symtab or psymtab for filename NAME is found, free it along
1136 with any dependent breakpoints, displays, etc.
1137 Used when loading new versions of object modules with the "add-file"
1138 command. This is only called on the top-level symtab or psymtab's name;
1139 it is not called for subsidiary files such as .h files.
1140
1141 Return value is 1 if we blew away the environment, 0 if not.
30875e1c 1142 FIXME. The return valu appears to never be used.
9d199712
JG
1143
1144 FIXME. I think this is not the best way to do this. We should
1145 work on being gentler to the environment while still cleaning up
1146 all stray pointers into the freed symtab. */
1147
1148int
1149free_named_symtabs (name)
1150 char *name;
1151{
30875e1c
SG
1152#if 0
1153 /* FIXME: With the new method of each objfile having it's own
1154 psymtab list, this function needs serious rethinking. In particular,
1155 why was it ever necessary to toss psymtabs with specific compilation
1156 unit filenames, as opposed to all psymtabs from a particular symbol
ac88ca20
JG
1157 file? -- fnf
1158 Well, the answer is that some systems permit reloading of particular
1159 compilation units. We want to blow away any old info about these
1160 compilation units, regardless of which objfiles they arrived in. --gnu. */
1161
1162 register struct symtab *s;
1163 register struct symtab *prev;
1164 register struct partial_symtab *ps;
1165 struct blockvector *bv;
1166 int blewit = 0;
30875e1c 1167
61a7292f
SG
1168 /* We only wack things if the symbol-reload switch is set. */
1169 if (!symbol_reloading)
1170 return 0;
1171
d11c44f1
JG
1172 /* Some symbol formats have trouble providing file names... */
1173 if (name == 0 || *name == '\0')
1174 return 0;
1175
9d199712
JG
1176 /* Look for a psymtab with the specified name. */
1177
1178again2:
1179 for (ps = partial_symtab_list; ps; ps = ps->next) {
1180 if (!strcmp (name, ps->filename)) {
1181 cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
1182 goto again2; /* Must restart, chain has been munged */
1183 }
1184 }
1185
1186 /* Look for a symtab with the specified name. */
1187
1188 for (s = symtab_list; s; s = s->next)
1189 {
1190 if (!strcmp (name, s->filename))
1191 break;
1192 prev = s;
1193 }
1194
1195 if (s)
1196 {
1197 if (s == symtab_list)
1198 symtab_list = s->next;
1199 else
1200 prev->next = s->next;
1201
1202 /* For now, queue a delete for all breakpoints, displays, etc., whether
1203 or not they depend on the symtab being freed. This should be
1204 changed so that only those data structures affected are deleted. */
1205
1206 /* But don't delete anything if the symtab is empty.
1207 This test is necessary due to a bug in "dbxread.c" that
1208 causes empty symtabs to be created for N_SO symbols that
1209 contain the pathname of the object file. (This problem
1210 has been fixed in GDB 3.9x). */
1211
c9bd6710
JG
1212 bv = BLOCKVECTOR (s);
1213 if (BLOCKVECTOR_NBLOCKS (bv) > 2
9d199712
JG
1214 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
1215 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)))
1216 {
1217 complain (&oldsyms_complaint, name);
1218
1219 clear_symtab_users_queued++;
1220 make_cleanup (clear_symtab_users_once, 0);
1221 blewit = 1;
1222 } else {
1223 complain (&empty_symtab_complaint, name);
1224 }
1225
1226 free_symtab (s);
1227 }
1228 else
d8ce1326
JG
1229 {
1230 /* It is still possible that some breakpoints will be affected
1231 even though no symtab was found, since the file might have
1232 been compiled without debugging, and hence not be associated
1233 with a symtab. In order to handle this correctly, we would need
1234 to keep a list of text address ranges for undebuggable files.
1235 For now, we do nothing, since this is a fairly obscure case. */
1236 ;
1237 }
9d199712 1238
30875e1c 1239 /* FIXME, what about the minimal symbol table? */
9d199712 1240 return blewit;
30875e1c
SG
1241#else
1242 return (0);
1243#endif
9d199712
JG
1244}
1245\f
d4ea2aba
PB
1246/* Allocate and partially fill a partial symtab. It will be
1247 completely filled at the end of the symbol list.
1248
1249 SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
1250 is the address relative to which its symbols are (incremental) or 0
1251 (normal). */
1252
1253
1254struct partial_symtab *
1255start_psymtab_common (objfile, addr,
1256 filename, textlow, global_syms, static_syms)
1257 struct objfile *objfile;
1258 CORE_ADDR addr;
1259 char *filename;
1260 CORE_ADDR textlow;
1261 struct partial_symbol *global_syms;
1262 struct partial_symbol *static_syms;
1263{
30875e1c
SG
1264 struct partial_symtab *psymtab;
1265
1266 psymtab = allocate_psymtab (filename, objfile);
1267 psymtab -> addr = addr;
1268 psymtab -> textlow = textlow;
1269 psymtab -> texthigh = psymtab -> textlow; /* default */
1270 psymtab -> globals_offset = global_syms - objfile -> global_psymbols.list;
1271 psymtab -> statics_offset = static_syms - objfile -> static_psymbols.list;
1272 return (psymtab);
7d9884b9 1273}
9342ecb9
JG
1274\f
1275/* Debugging versions of functions that are usually inline macros
1276 (see symfile.h). */
1277
1278#if 0 /* Don't quite work nowadays... */
1279
1280/* Add a symbol with a long value to a psymtab.
1281 Since one arg is a struct, we pass in a ptr and deref it (sigh). */
1282
1283void
1284add_psymbol_to_list (name, namelength, namespace, class, list, val)
1285 char *name;
1286 int namelength;
1287 enum namespace namespace;
1288 enum address_class class;
1289 struct psymbol_allocation_list *list;
1290 long val;
1291{
1292 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
1293 SYMBOL_VALUE);
1294}
1295
1296/* Add a symbol with a CORE_ADDR value to a psymtab. */
1297
1298void
1299add_psymbol_addr_to_list (name, namelength, namespace, class, list, val)
1300 char *name;
1301 int namelength;
1302 enum namespace namespace;
1303 enum address_class class;
1304 struct psymbol_allocation_list *list;
1305 CORE_ADDR val;
1306{
1307 ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
1308 SYMBOL_VALUE_ADDRESS);
1309}
7d9884b9 1310
9342ecb9 1311#endif /* 0 */
7d9884b9 1312\f
bd5635a1
RP
1313void
1314_initialize_symfile ()
1315{
1316
1317 add_com ("symbol-file", class_files, symbol_file_command,
30875e1c 1318 "Load symbol table from executable file FILE.\n\
bd5635a1
RP
1319The `file' command can also load symbol tables, as well as setting the file\n\
1320to execute.");
1321
e74d7b43 1322 add_com ("add-symbol-file", class_files, add_symbol_file_command,
bd5635a1
RP
1323 "Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\
1324The second argument provides the starting address of the file's text.");
1325
1326 add_com ("load", class_files, load_command,
1327 "Dynamically load FILE into the running program, and record its symbols\n\
1328for access from GDB.");
1329
1330 add_show_from_set
4369a140 1331 (add_set_cmd ("complaints", class_support, var_zinteger,
bd5635a1
RP
1332 (char *)&stop_whining,
1333 "Set max number of complaints about incorrect symbols.",
1334 &setlist),
1335 &showlist);
1336
61a7292f
SG
1337 add_show_from_set
1338 (add_set_cmd ("symbol-reloading", class_support, var_boolean,
1339 (char *)&symbol_reloading,
1340 "Set dynamic symbol table reloading multiple times in one run.",
1341 &setlist),
1342 &showlist);
1343
bd5635a1 1344}
This page took 0.151059 seconds and 4 git commands to generate.