* ch-valprint.c (chill_val_print): Remove call to calculate_array_length.
[deliverable/binutils-gdb.git] / gdb / symfile.c
CommitLineData
bd5635a1 1/* Generic symbol file reading for the GNU debugger, GDB.
f1d39876
FF
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996
3 Free Software Foundation, Inc.
bd5635a1
RP
4 Contributed by Cygnus Support, using pieces from other GDB modules.
5
6This file is part of GDB.
7
61a7292f 8This program is free software; you can redistribute it and/or modify
bd5635a1 9it under the terms of the GNU General Public License as published by
61a7292f
SG
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
bd5635a1 12
61a7292f 13This program is distributed in the hope that it will be useful,
bd5635a1
RP
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
61a7292f 19along with this program; if not, write to the Free Software
dee7a11c 20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
bd5635a1 21
bd5635a1
RP
22#include "defs.h"
23#include "symtab.h"
30875e1c 24#include "gdbtypes.h"
bd5635a1
RP
25#include "gdbcore.h"
26#include "frame.h"
27#include "target.h"
28#include "value.h"
29#include "symfile.h"
bf349b77 30#include "objfiles.h"
bd5635a1
RP
31#include "gdbcmd.h"
32#include "breakpoint.h"
e58de8a2 33#include "language.h"
51b80b00 34#include "complaints.h"
2e4964ad 35#include "demangle.h"
4d57c599 36#include "inferior.h" /* for write_pc */
bd5635a1 37
2dd30c72 38#include "obstack.h"
bd5635a1
RP
39#include <assert.h>
40
41#include <sys/types.h>
42#include <fcntl.h>
2b576293
C
43#include "gdb_string.h"
44#include "gdb_stat.h"
9342ecb9 45#include <ctype.h>
b52cac6b 46#include <time.h>
1a494973
C
47#ifdef HAVE_UNISTD_H
48#include <unistd.h>
49#endif
bd5635a1 50
2093fe68
RP
51#ifndef O_BINARY
52#define O_BINARY 0
53#endif
54
30875e1c 55/* Global variables owned by this file */
80d68b1d 56int readnow_symbol_files; /* Read full symbols immediately */
d47d5315 57
51b80b00
FF
58struct complaint oldsyms_complaint = {
59 "Replacing old symbols for `%s'", 0, 0
60};
61
62struct complaint empty_symtab_complaint = {
63 "Empty symbol table found for `%s'", 0, 0
64};
65
30875e1c 66/* External variables and functions referenced. */
bd5635a1 67
30875e1c 68extern int info_verbose;
bd5635a1 69
72158e71
SS
70extern void report_transfer_performance PARAMS ((unsigned long,
71 time_t, time_t));
72
bd5635a1 73/* Functions this file defines */
7d9884b9 74
72158e71 75static void set_initial_language PARAMS ((void));
e58de8a2 76
72158e71 77static void load_command PARAMS ((char *, int));
30875e1c 78
72158e71 79static void add_symbol_file_command PARAMS ((char *, int));
30875e1c 80
72158e71 81static void add_shared_symbol_files_command PARAMS ((char *, int));
f3806e3b 82
72158e71 83static void cashier_psymtab PARAMS ((struct partial_symtab *));
bd5635a1 84
72158e71 85static int compare_psymbols PARAMS ((const void *, const void *));
bd5635a1 86
72158e71 87static int compare_symbols PARAMS ((const void *, const void *));
30875e1c 88
72158e71 89static bfd *symfile_bfd_open PARAMS ((char *));
30875e1c 90
72158e71 91static void find_sym_fns PARAMS ((struct objfile *));
30875e1c 92
80d68b1d
FF
93/* List of all available sym_fns. On gdb startup, each object file reader
94 calls add_symtab_fns() to register information on each format it is
95 prepared to read. */
bd5635a1 96
80d68b1d 97static struct sym_fns *symtab_fns = NULL;
bd5635a1 98
61a7292f
SG
99/* Flag for whether user will be reloading symbols multiple times.
100 Defaults to ON for VxWorks, otherwise OFF. */
101
102#ifdef SYMBOL_RELOADING_DEFAULT
103int symbol_reloading = SYMBOL_RELOADING_DEFAULT;
104#else
105int symbol_reloading = 0;
106#endif
107
dee7a11c 108/* If true, then shared library symbols will be added automatically
f1d39876
FF
109 when the inferior is created, new libraries are loaded, or when
110 attaching to the inferior. This is almost always what users
dee7a11c
FF
111 will want to have happen; but for very large programs, the startup
112 time will be excessive, and so if this is a problem, the user can
113 clear this flag and then add the shared library symbols as needed.
114 Note that there is a potential for confusion, since if the shared
115 library symbols are not loaded, commands like "info fun" will *not*
116 report all the functions that are actually present. */
117
f1d39876 118int auto_solib_add = 1;
dee7a11c 119
bd5635a1 120\f
ade40d31 121/* Since this function is called from within qsort, in an ANSI environment
30875e1c
SG
122 it must conform to the prototype for qsort, which specifies that the
123 comparison function takes two "void *" pointers. */
bd5635a1
RP
124
125static int
30875e1c
SG
126compare_symbols (s1p, s2p)
127 const PTR s1p;
128 const PTR s2p;
bd5635a1 129{
30875e1c 130 register struct symbol **s1, **s2;
bd5635a1 131
30875e1c
SG
132 s1 = (struct symbol **) s1p;
133 s2 = (struct symbol **) s2p;
134
ade40d31 135 return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
bd5635a1
RP
136}
137
30875e1c
SG
138/*
139
140LOCAL FUNCTION
141
142 compare_psymbols -- compare two partial symbols by name
143
144DESCRIPTION
145
2ad5709f
FF
146 Given pointers to pointers to two partial symbol table entries,
147 compare them by name and return -N, 0, or +N (ala strcmp).
148 Typically used by sorting routines like qsort().
30875e1c
SG
149
150NOTES
151
152 Does direct compare of first two characters before punting
153 and passing to strcmp for longer compares. Note that the
154 original version had a bug whereby two null strings or two
155 identically named one character strings would return the
156 comparison of memory following the null byte.
157
158 */
159
160static int
161compare_psymbols (s1p, s2p)
162 const PTR s1p;
163 const PTR s2p;
164{
2ad5709f
FF
165 register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p);
166 register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p);
30875e1c
SG
167
168 if ((st1[0] - st2[0]) || !st1[0])
169 {
170 return (st1[0] - st2[0]);
171 }
172 else if ((st1[1] - st2[1]) || !st1[1])
173 {
174 return (st1[1] - st2[1]);
175 }
176 else
177 {
2e4964ad 178 return (STRCMP (st1 + 2, st2 + 2));
30875e1c
SG
179 }
180}
181
182void
183sort_pst_symbols (pst)
184 struct partial_symtab *pst;
185{
186 /* Sort the global list; don't sort the static list */
187
188 qsort (pst -> objfile -> global_psymbols.list + pst -> globals_offset,
2ad5709f 189 pst -> n_global_syms, sizeof (struct partial_symbol *),
30875e1c
SG
190 compare_psymbols);
191}
192
bd5635a1
RP
193/* Call sort_block_syms to sort alphabetically the symbols of one block. */
194
195void
196sort_block_syms (b)
197 register struct block *b;
198{
199 qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
200 sizeof (struct symbol *), compare_symbols);
201}
202
203/* Call sort_symtab_syms to sort alphabetically
204 the symbols of each block of one symtab. */
205
206void
207sort_symtab_syms (s)
208 register struct symtab *s;
209{
c9bd6710
JG
210 register struct blockvector *bv;
211 int nbl;
bd5635a1
RP
212 int i;
213 register struct block *b;
214
c9bd6710
JG
215 if (s == 0)
216 return;
217 bv = BLOCKVECTOR (s);
218 nbl = BLOCKVECTOR_NBLOCKS (bv);
bd5635a1
RP
219 for (i = 0; i < nbl; i++)
220 {
221 b = BLOCKVECTOR_BLOCK (bv, i);
222 if (BLOCK_SHOULD_SORT (b))
223 sort_block_syms (b);
224 }
225}
226
bd5635a1
RP
227/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
228 (and add a null character at the end in the copy).
229 Returns the address of the copy. */
230
231char *
30875e1c 232obsavestring (ptr, size, obstackp)
bd5635a1
RP
233 char *ptr;
234 int size;
30875e1c 235 struct obstack *obstackp;
bd5635a1 236{
30875e1c 237 register char *p = (char *) obstack_alloc (obstackp, size + 1);
ade40d31 238 /* Open-coded memcpy--saves function call time.
bd5635a1
RP
239 These strings are usually short. */
240 {
241 register char *p1 = ptr;
242 register char *p2 = p;
243 char *end = ptr + size;
244 while (p1 != end)
245 *p2++ = *p1++;
246 }
247 p[size] = 0;
248 return p;
249}
250
251/* Concatenate strings S1, S2 and S3; return the new string.
252 Space is found in the symbol_obstack. */
253
254char *
30875e1c
SG
255obconcat (obstackp, s1, s2, s3)
256 struct obstack *obstackp;
257 const char *s1, *s2, *s3;
bd5635a1
RP
258{
259 register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
30875e1c 260 register char *val = (char *) obstack_alloc (obstackp, len);
bd5635a1
RP
261 strcpy (val, s1);
262 strcat (val, s2);
263 strcat (val, s3);
264 return val;
265}
bd5635a1 266
7ef89313
PB
267/* True if we are nested inside psymtab_to_symtab. */
268
269int currently_reading_symtab = 0;
270
b52cac6b 271static void
7ef89313
PB
272decrement_reading_symtab (dummy)
273 void *dummy;
274{
275 currently_reading_symtab--;
276}
277
bd5635a1
RP
278/* Get the symbol table that corresponds to a partial_symtab.
279 This is fast after the first time you do it. In fact, there
280 is an even faster macro PSYMTAB_TO_SYMTAB that does the fast
281 case inline. */
282
283struct symtab *
284psymtab_to_symtab (pst)
285 register struct partial_symtab *pst;
286{
bd5635a1
RP
287 /* If it's been looked up before, return it. */
288 if (pst->symtab)
289 return pst->symtab;
290
291 /* If it has not yet been read in, read it. */
292 if (!pst->readin)
293 {
7ef89313
PB
294 struct cleanup *back_to = make_cleanup (decrement_reading_symtab, NULL);
295 currently_reading_symtab++;
bd5635a1 296 (*pst->read_symtab) (pst);
7ef89313 297 do_cleanups (back_to);
bd5635a1
RP
298 }
299
61a7292f 300 return pst->symtab;
bd5635a1
RP
301}
302
bf349b77
FF
303/* Initialize entry point information for this objfile. */
304
305void
306init_entry_point_info (objfile)
307 struct objfile *objfile;
308{
309 /* Save startup file's range of PC addresses to help blockframe.c
310 decide where the bottom of the stack is. */
311
312 if (bfd_get_file_flags (objfile -> obfd) & EXEC_P)
313 {
314 /* Executable file -- record its entry point so we'll recognize
315 the startup file because it contains the entry point. */
316 objfile -> ei.entry_point = bfd_get_start_address (objfile -> obfd);
317 }
318 else
319 {
320 /* Examination of non-executable.o files. Short-circuit this stuff. */
f3806e3b 321 objfile -> ei.entry_point = INVALID_ENTRY_POINT;
bf349b77 322 }
dee7a11c
FF
323 objfile -> ei.entry_file_lowpc = INVALID_ENTRY_LOWPC;
324 objfile -> ei.entry_file_highpc = INVALID_ENTRY_HIGHPC;
325 objfile -> ei.entry_func_lowpc = INVALID_ENTRY_LOWPC;
326 objfile -> ei.entry_func_highpc = INVALID_ENTRY_HIGHPC;
327 objfile -> ei.main_func_lowpc = INVALID_ENTRY_LOWPC;
328 objfile -> ei.main_func_highpc = INVALID_ENTRY_HIGHPC;
bf349b77
FF
329}
330
4d57c599
JK
331/* Get current entry point address. */
332
333CORE_ADDR
334entry_point_address()
335{
336 return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
337}
338
a8e033f2 339/* Remember the lowest-addressed loadable section we've seen.
1a494973
C
340 This function is called via bfd_map_over_sections.
341
342 In case of equal vmas, the section with the largest size becomes the
343 lowest-addressed loadable section.
344
345 If the vmas and sizes are equal, the last section is considered the
346 lowest-addressed loadable section. */
a8e033f2 347
464c6c5f 348void
a8e033f2
SG
349find_lowest_section (abfd, sect, obj)
350 bfd *abfd;
351 asection *sect;
352 PTR obj;
353{
354 asection **lowest = (asection **)obj;
355
356 if (0 == (bfd_get_section_flags (abfd, sect) & SEC_LOAD))
357 return;
358 if (!*lowest)
359 *lowest = sect; /* First loadable section */
1a494973 360 else if (bfd_section_vma (abfd, *lowest) > bfd_section_vma (abfd, sect))
a8e033f2 361 *lowest = sect; /* A lower loadable section */
1a494973
C
362 else if (bfd_section_vma (abfd, *lowest) == bfd_section_vma (abfd, sect)
363 && (bfd_section_size (abfd, (*lowest))
364 <= bfd_section_size (abfd, sect)))
365 *lowest = sect;
a8e033f2 366}
a8e033f2 367
bd5635a1
RP
368/* Process a symbol file, as either the main file or as a dynamically
369 loaded file.
370
b3fdaf3d
JK
371 NAME is the file name (which will be tilde-expanded and made
372 absolute herein) (but we don't free or modify NAME itself).
373 FROM_TTY says how verbose to be. MAINLINE specifies whether this
374 is the main symbol file, or whether it's an extra symbol file such
375 as dynamically loaded code. If !mainline, ADDR is the address
4369a140
JG
376 where the text segment was loaded. If VERBO, the caller has printed
377 a verbose message about the symbol reading (and complaints can be
378 more terse about it). */
bd5635a1
RP
379
380void
4369a140 381syms_from_objfile (objfile, addr, mainline, verbo)
7d9884b9 382 struct objfile *objfile;
bd5635a1
RP
383 CORE_ADDR addr;
384 int mainline;
4369a140 385 int verbo;
bd5635a1 386{
a8e033f2
SG
387 struct section_offsets *section_offsets;
388 asection *lowest_sect;
ade40d31 389 struct cleanup *old_chain;
bd5635a1 390
bf349b77 391 init_entry_point_info (objfile);
80d68b1d 392 find_sym_fns (objfile);
bd5635a1 393
ade40d31
RP
394 /* Make sure that partially constructed symbol tables will be cleaned up
395 if an error occurs during symbol reading. */
396 old_chain = make_cleanup (free_objfile, objfile);
397
bd5635a1
RP
398 if (mainline)
399 {
ade40d31
RP
400 /* We will modify the main symbol table, make sure that all its users
401 will be cleaned up if an error occurs during symbol reading. */
402 make_cleanup (clear_symtab_users, 0);
403
bd5635a1
RP
404 /* Since no error yet, throw away the old symbol table. */
405
80d68b1d
FF
406 if (symfile_objfile != NULL)
407 {
408 free_objfile (symfile_objfile);
409 symfile_objfile = NULL;
410 }
bd5635a1 411
f6c4bf1a
JK
412 /* Currently we keep symbols from the add-symbol-file command.
413 If the user wants to get rid of them, they should do "symbol-file"
414 without arguments first. Not sure this is the best behavior
415 (PR 2207). */
416
80d68b1d 417 (*objfile -> sf -> sym_new_init) (objfile);
a8e033f2 418 }
bd5635a1 419
a8e033f2
SG
420 /* Convert addr into an offset rather than an absolute address.
421 We find the lowest address of a loaded segment in the objfile,
422 and assume that <addr> is where that got loaded. Due to historical
1a494973 423 precedent, we warn if that doesn't happen to be a text segment. */
80d68b1d 424
a8e033f2
SG
425 if (mainline)
426 {
427 addr = 0; /* No offset from objfile addresses. */
428 }
429 else
430 {
431 lowest_sect = bfd_get_section_by_name (objfile->obfd, ".text");
1a494973
C
432 if (lowest_sect == NULL)
433 bfd_map_over_sections (objfile->obfd, find_lowest_section,
434 (PTR) &lowest_sect);
a8e033f2 435
1a494973 436 if (lowest_sect == NULL)
a8e033f2
SG
437 warning ("no loadable sections found in added symbol-file %s",
438 objfile->name);
1a494973
C
439 else if ((bfd_get_section_flags (objfile->obfd, lowest_sect) & SEC_CODE)
440 == 0)
c4a081e1 441 /* FIXME-32x64--assumes bfd_vma fits in long. */
4d57c599 442 warning ("Lowest section in %s is %s at 0x%lx",
a8e033f2
SG
443 objfile->name,
444 bfd_section_name (objfile->obfd, lowest_sect),
4d57c599 445 (unsigned long) bfd_section_vma (objfile->obfd, lowest_sect));
a8e033f2
SG
446
447 if (lowest_sect)
448 addr -= bfd_section_vma (objfile->obfd, lowest_sect);
bd5635a1
RP
449 }
450
80d68b1d
FF
451 /* Initialize symbol reading routines for this objfile, allow complaints to
452 appear for this new file, and record how verbose to be, then do the
453 initial symbol reading for this file. */
4369a140 454
80d68b1d
FF
455 (*objfile -> sf -> sym_init) (objfile);
456 clear_complaints (1, verbo);
2093fe68 457
a8e033f2 458 section_offsets = (*objfile -> sf -> sym_offsets) (objfile, addr);
2093fe68
RP
459 objfile->section_offsets = section_offsets;
460
4365c36c
JK
461#ifndef IBM6000_TARGET
462 /* This is a SVR4/SunOS specific hack, I think. In any event, it
463 screws RS/6000. sym_offsets should be doing this sort of thing,
464 because it knows the mapping between bfd sections and
465 section_offsets. */
5aefc1ca
FF
466 /* This is a hack. As far as I can tell, section offsets are not
467 target dependent. They are all set to addr with a couple of
468 exceptions. The exceptions are sysvr4 shared libraries, whose
469 offsets are kept in solib structures anyway and rs6000 xcoff
470 which handles shared libraries in a completely unique way.
471
472 Section offsets are built similarly, except that they are built
473 by adding addr in all cases because there is no clear mapping
474 from section_offsets into actual sections. Note that solib.c
475 has a different algorythm for finding section offsets.
476
477 These should probably all be collapsed into some target
478 independent form of shared library support. FIXME. */
479
480 if (addr)
481 {
482 struct obj_section *s;
483
484 for (s = objfile->sections; s < objfile->sections_end; ++s)
485 {
486 s->addr -= s->offset;
487 s->addr += addr;
488 s->endaddr -= s->offset;
489 s->endaddr += addr;
490 s->offset += addr;
491 }
492 }
4365c36c 493#endif /* not IBM6000_TARGET */
5aefc1ca 494
a8e033f2 495 (*objfile -> sf -> sym_read) (objfile, section_offsets, mainline);
bd5635a1 496
f3806e3b
PS
497 if (!have_partial_symbols () && !have_full_symbols ())
498 {
499 wrap_here ("");
500 printf_filtered ("(no debugging symbols found)...");
501 wrap_here ("");
502 }
503
4d57c599
JK
504 /* Don't allow char * to have a typename (else would get caddr_t).
505 Ditto void *. FIXME: Check whether this is now done by all the
506 symbol readers themselves (many of them now do), and if so remove
507 it from here. */
bd5635a1
RP
508
509 TYPE_NAME (lookup_pointer_type (builtin_type_char)) = 0;
510 TYPE_NAME (lookup_pointer_type (builtin_type_void)) = 0;
511
9342ecb9
JG
512 /* Mark the objfile has having had initial symbol read attempted. Note
513 that this does not mean we found any symbols... */
514
515 objfile -> flags |= OBJF_SYMS;
ade40d31
RP
516
517 /* Discard cleanups as symbol reading was successful. */
518
519 discard_cleanups (old_chain);
dee7a11c
FF
520
521/* Call this after reading in a new symbol table to give target dependant code
522 a crack at the new symbols. For instance, this could be used to update the
523 values of target-specific symbols GDB needs to keep track of (such as
524 _sigtramp, or whatever). */
525
526 TARGET_SYMFILE_POSTREAD (objfile);
9342ecb9
JG
527}
528
ade40d31 529/* Perform required actions after either reading in the initial
9342ecb9
JG
530 symbols for a new objfile, or mapping in the symbols from a reusable
531 objfile. */
532
533void
534new_symfile_objfile (objfile, mainline, verbo)
535 struct objfile *objfile;
536 int mainline;
537 int verbo;
538{
ade40d31
RP
539
540 /* If this is the main symbol file we have to clean up all users of the
541 old main symbol file. Otherwise it is sufficient to fixup all the
542 breakpoints that may have been redefined by this symbol file. */
bd5635a1
RP
543 if (mainline)
544 {
545 /* OK, make it the "real" symbol file. */
7d9884b9 546 symfile_objfile = objfile;
bd5635a1 547
ade40d31
RP
548 clear_symtab_users ();
549 }
550 else
551 {
552 breakpoint_re_set ();
553 }
4369a140
JG
554
555 /* We're done reading the symbol file; finish off complaints. */
80d68b1d 556 clear_complaints (0, verbo);
30875e1c 557}
d47d5315
JG
558
559/* Process a symbol file, as either the main file or as a dynamically
560 loaded file.
561
562 NAME is the file name (which will be tilde-expanded and made
563 absolute herein) (but we don't free or modify NAME itself).
564 FROM_TTY says how verbose to be. MAINLINE specifies whether this
565 is the main symbol file, or whether it's an extra symbol file such
566 as dynamically loaded code. If !mainline, ADDR is the address
30875e1c 567 where the text segment was loaded.
d47d5315 568
30875e1c
SG
569 Upon success, returns a pointer to the objfile that was added.
570 Upon failure, jumps back to command level (never returns). */
571
572struct objfile *
b0246b3b 573symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
d47d5315
JG
574 char *name;
575 int from_tty;
576 CORE_ADDR addr;
577 int mainline;
318bf84f 578 int mapped;
b0246b3b 579 int readnow;
d47d5315 580{
7d9884b9 581 struct objfile *objfile;
b0246b3b 582 struct partial_symtab *psymtab;
80d68b1d 583 bfd *abfd;
d47d5315 584
2093fe68
RP
585 /* Open a bfd for the file, and give user a chance to burp if we'd be
586 interactively wiping out any existing symbols. */
80d68b1d
FF
587
588 abfd = symfile_bfd_open (name);
d47d5315 589
80d68b1d
FF
590 if ((have_full_symbols () || have_partial_symbols ())
591 && mainline
592 && from_tty
593 && !query ("Load new symbol table from \"%s\"? ", name))
594 error ("Not confirmed.");
a8e033f2 595
80d68b1d
FF
596 objfile = allocate_objfile (abfd, mapped);
597
318bf84f
FF
598 /* If the objfile uses a mapped symbol file, and we have a psymtab for
599 it, then skip reading any symbols at this time. */
d47d5315 600
bf349b77 601 if ((objfile -> flags & OBJF_MAPPED) && (objfile -> flags & OBJF_SYMS))
d47d5315 602 {
80d68b1d 603 /* We mapped in an existing symbol table file that already has had
bf349b77
FF
604 initial symbol reading performed, so we can skip that part. Notify
605 the user that instead of reading the symbols, they have been mapped.
606 */
318bf84f
FF
607 if (from_tty || info_verbose)
608 {
80d68b1d
FF
609 printf_filtered ("Mapped symbols for %s...", name);
610 wrap_here ("");
199b2450 611 gdb_flush (gdb_stdout);
318bf84f 612 }
9342ecb9
JG
613 init_entry_point_info (objfile);
614 find_sym_fns (objfile);
d47d5315 615 }
318bf84f 616 else
bd5635a1 617 {
80d68b1d 618 /* We either created a new mapped symbol table, mapped an existing
bf349b77
FF
619 symbol table file which has not had initial symbol reading
620 performed, or need to read an unmapped symbol table. */
318bf84f
FF
621 if (from_tty || info_verbose)
622 {
623 printf_filtered ("Reading symbols from %s...", name);
624 wrap_here ("");
199b2450 625 gdb_flush (gdb_stdout);
318bf84f 626 }
318bf84f 627 syms_from_objfile (objfile, addr, mainline, from_tty);
80d68b1d
FF
628 }
629
630 /* We now have at least a partial symbol table. Check to see if the
631 user requested that all symbols be read on initial access via either
632 the gdb startup command line or on a per symbol file basis. Expand
633 all partial symbol tables for this objfile if so. */
b0246b3b 634
bf349b77 635 if (readnow || readnow_symbol_files)
80d68b1d 636 {
318bf84f
FF
637 if (from_tty || info_verbose)
638 {
80d68b1d
FF
639 printf_filtered ("expanding to full symbols...");
640 wrap_here ("");
199b2450 641 gdb_flush (gdb_stdout);
318bf84f 642 }
80d68b1d
FF
643
644 for (psymtab = objfile -> psymtabs;
645 psymtab != NULL;
646 psymtab = psymtab -> next)
647 {
4ed3a9ea 648 psymtab_to_symtab (psymtab);
80d68b1d
FF
649 }
650 }
651
652 if (from_tty || info_verbose)
653 {
654 printf_filtered ("done.\n");
199b2450 655 gdb_flush (gdb_stdout);
bd5635a1 656 }
80d68b1d 657
ade40d31 658 new_symfile_objfile (objfile, mainline, from_tty);
ade40d31 659
30875e1c 660 return (objfile);
bd5635a1
RP
661}
662
2e6784a8
SG
663/* This is the symbol-file command. Read the file, analyze its
664 symbols, and add a struct symtab to a symtab list. The syntax of
665 the command is rather bizarre--(1) buildargv implements various
666 quoting conventions which are undocumented and have little or
667 nothing in common with the way things are quoted (or not quoted)
668 elsewhere in GDB, (2) options are used, which are not generally
669 used in GDB (perhaps "set mapped on", "set readnow on" would be
670 better), (3) the order of options matters, which is contrary to GNU
671 conventions (because it is confusing and inconvenient). */
bd5635a1
RP
672
673void
30875e1c
SG
674symbol_file_command (args, from_tty)
675 char *args;
bd5635a1
RP
676 int from_tty;
677{
30875e1c 678 char **argv;
b0246b3b 679 char *name = NULL;
25200748 680 CORE_ADDR text_relocation = 0; /* text_relocation */
30875e1c 681 struct cleanup *cleanups;
318bf84f 682 int mapped = 0;
30875e1c 683 int readnow = 0;
bd5635a1
RP
684
685 dont_repeat ();
686
30875e1c 687 if (args == NULL)
bd5635a1 688 {
cba0d141
JG
689 if ((have_full_symbols () || have_partial_symbols ())
690 && from_tty
691 && !query ("Discard symbol table from `%s'? ",
692 symfile_objfile -> name))
693 error ("Not confirmed.");
694 free_all_objfiles ();
30875e1c 695 symfile_objfile = NULL;
9342ecb9
JG
696 if (from_tty)
697 {
199b2450 698 printf_unfiltered ("No symbol file now.\n");
9342ecb9 699 }
bd5635a1 700 }
30875e1c
SG
701 else
702 {
703 if ((argv = buildargv (args)) == NULL)
704 {
318bf84f 705 nomem (0);
30875e1c
SG
706 }
707 cleanups = make_cleanup (freeargv, (char *) argv);
b0246b3b 708 while (*argv != NULL)
30875e1c 709 {
2e4964ad 710 if (STREQ (*argv, "-mapped"))
30875e1c 711 {
318bf84f 712 mapped = 1;
30875e1c 713 }
2e4964ad 714 else if (STREQ (*argv, "-readnow"))
30875e1c
SG
715 {
716 readnow = 1;
717 }
b0246b3b
FF
718 else if (**argv == '-')
719 {
720 error ("unknown option `%s'", *argv);
721 }
722 else
723 {
d9389f37
KH
724 char *p;
725
726 name = *argv;
727
728 /* this is for rombug remote only, to get the text relocation by
729 using link command */
730 p = strrchr(name, '/');
731 if (p != NULL) p++;
732 else p = name;
733
734 target_link(p, &text_relocation);
735
736 if (text_relocation == (CORE_ADDR)0)
737 return;
738 else if (text_relocation == (CORE_ADDR)-1)
d5412302
JK
739 symbol_file_add (name, from_tty, (CORE_ADDR)0, 1, mapped,
740 readnow);
d9389f37 741 else
d5412302
JK
742 symbol_file_add (name, from_tty, (CORE_ADDR)text_relocation,
743 0, mapped, readnow);
76212295
PS
744
745 /* Getting new symbols may change our opinion about what is
746 frameless. */
747 reinit_frame_cache ();
748
d9389f37 749 set_initial_language ();
b0246b3b
FF
750 }
751 argv++;
30875e1c 752 }
2403f49b 753
b0246b3b
FF
754 if (name == NULL)
755 {
756 error ("no symbol file name was specified");
757 }
30875e1c
SG
758 do_cleanups (cleanups);
759 }
bd5635a1
RP
760}
761
e58de8a2
FF
762/* Set the initial language.
763
764 A better solution would be to record the language in the psymtab when reading
765 partial symbols, and then use it (if known) to set the language. This would
766 be a win for formats that encode the language in an easily discoverable place,
767 such as DWARF. For stabs, we can jump through hoops looking for specially
768 named symbols or try to intuit the language from the specific type of stabs
769 we find, but we can't do that until later when we read in full symbols.
770 FIXME. */
771
772static void
773set_initial_language ()
774{
775 struct partial_symtab *pst;
776 enum language lang = language_unknown;
777
778 pst = find_main_psymtab ();
779 if (pst != NULL)
780 {
781 if (pst -> filename != NULL)
782 {
783 lang = deduce_language_from_filename (pst -> filename);
784 }
785 if (lang == language_unknown)
786 {
787 /* Make C the default language */
788 lang = language_c;
789 }
790 set_language (lang);
791 expected_language = current_language; /* Don't warn the user */
792 }
793}
794
b0246b3b
FF
795/* Open file specified by NAME and hand it off to BFD for preliminary
796 analysis. Result is a newly initialized bfd *, which includes a newly
797 malloc'd` copy of NAME (tilde-expanded and made absolute).
7d9884b9 798 In case of trouble, error() is called. */
bd5635a1 799
b0246b3b
FF
800static bfd *
801symfile_bfd_open (name)
bd5635a1
RP
802 char *name;
803{
804 bfd *sym_bfd;
805 int desc;
806 char *absolute_name;
807
7d9884b9 808 name = tilde_expand (name); /* Returns 1st new malloc'd copy */
bd5635a1 809
7d9884b9 810 /* Look down path for it, allocate 2nd new malloc'd copy. */
2093fe68 811 desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
b0246b3b
FF
812 if (desc < 0)
813 {
814 make_cleanup (free, name);
815 perror_with_name (name);
816 }
7d9884b9 817 free (name); /* Free 1st new malloc'd copy */
30875e1c 818 name = absolute_name; /* Keep 2nd malloc'd copy in bfd */
346168a2 819 /* It'll be freed in free_objfile(). */
bd5635a1 820
ade40d31 821 sym_bfd = bfd_fdopenr (name, gnutarget, desc);
bd5635a1
RP
822 if (!sym_bfd)
823 {
824 close (desc);
7d9884b9 825 make_cleanup (free, name);
b0246b3b 826 error ("\"%s\": can't open to read symbols: %s.", name,
c4a081e1 827 bfd_errmsg (bfd_get_error ()));
bd5635a1 828 }
e58de8a2 829 sym_bfd->cacheable = true;
bd5635a1 830
b0246b3b
FF
831 if (!bfd_check_format (sym_bfd, bfd_object))
832 {
1a494973
C
833 /* FIXME: should be checking for errors from bfd_close (for one thing,
834 on error it does not free all the storage associated with the
835 bfd). */
b0246b3b
FF
836 bfd_close (sym_bfd); /* This also closes desc */
837 make_cleanup (free, name);
838 error ("\"%s\": can't read symbols: %s.", name,
c4a081e1 839 bfd_errmsg (bfd_get_error ()));
b0246b3b 840 }
7d9884b9 841
b0246b3b 842 return (sym_bfd);
7d9884b9
JG
843}
844
80d68b1d
FF
845/* Link a new symtab_fns into the global symtab_fns list. Called on gdb
846 startup by the _initialize routine in each object file format reader,
847 to register information about each format the the reader is prepared
848 to handle. */
bd5635a1
RP
849
850void
851add_symtab_fns (sf)
852 struct sym_fns *sf;
853{
854 sf->next = symtab_fns;
855 symtab_fns = sf;
856}
857
858
859/* Initialize to read symbols from the symbol file sym_bfd. It either
80d68b1d
FF
860 returns or calls error(). The result is an initialized struct sym_fns
861 in the objfile structure, that contains cached information about the
862 symbol file. */
bd5635a1 863
80d68b1d
FF
864static void
865find_sym_fns (objfile)
7d9884b9 866 struct objfile *objfile;
bd5635a1 867{
ac88ca20 868 struct sym_fns *sf;
0eed42de 869 enum bfd_flavour our_flavour = bfd_get_flavour (objfile -> obfd);
c4a081e1 870 char *our_target = bfd_get_target (objfile -> obfd);
0eed42de 871
1750a5ef
SC
872 /* Special kludge for RS/6000 and PowerMac. See xcoffread.c. */
873 if (STREQ (our_target, "aixcoff-rs6000") ||
874 STREQ (our_target, "xcoff-powermac"))
0eed42de 875 our_flavour = (enum bfd_flavour)-1;
bd5635a1 876
c4a081e1
DM
877 /* Special kludge for apollo. See dstread.c. */
878 if (STREQN (our_target, "apollo", 6))
879 our_flavour = (enum bfd_flavour)-2;
880
80d68b1d 881 for (sf = symtab_fns; sf != NULL; sf = sf -> next)
bd5635a1 882 {
0eed42de 883 if (our_flavour == sf -> sym_flavour)
bd5635a1 884 {
80d68b1d
FF
885 objfile -> sf = sf;
886 return;
bd5635a1
RP
887 }
888 }
c9bd6710 889 error ("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown.",
b0246b3b 890 bfd_get_target (objfile -> obfd));
bd5635a1
RP
891}
892\f
893/* This function runs the load command of our current target. */
894
30875e1c 895static void
bd5635a1
RP
896load_command (arg, from_tty)
897 char *arg;
898 int from_tty;
899{
f3806e3b
PS
900 if (arg == NULL)
901 arg = get_exec_file (1);
bd5635a1
RP
902 target_load (arg, from_tty);
903}
904
ade40d31
RP
905/* This version of "load" should be usable for any target. Currently
906 it is just used for remote targets, not inftarg.c or core files,
907 on the theory that only in that case is it useful.
908
909 Avoiding xmodem and the like seems like a win (a) because we don't have
910 to worry about finding it, and (b) On VMS, fork() is very slow and so
911 we don't want to run a subprocess. On the other hand, I'm not sure how
912 performance compares. */
913void
914generic_load (filename, from_tty)
915 char *filename;
916 int from_tty;
917{
918 struct cleanup *old_cleanups;
919 asection *s;
c4a081e1 920 bfd *loadfile_bfd;
b52cac6b 921 time_t start_time, end_time; /* Start and end times of download */
67c1413d 922 unsigned long data_count = 0; /* Number of bytes transferred to memory */
c4a081e1 923
c4a081e1 924 loadfile_bfd = bfd_openr (filename, gnutarget);
ade40d31
RP
925 if (loadfile_bfd == NULL)
926 {
927 perror_with_name (filename);
928 return;
929 }
1a494973
C
930 /* FIXME: should be checking for errors from bfd_close (for one thing,
931 on error it does not free all the storage associated with the
932 bfd). */
ade40d31
RP
933 old_cleanups = make_cleanup (bfd_close, loadfile_bfd);
934
935 if (!bfd_check_format (loadfile_bfd, bfd_object))
936 {
937 error ("\"%s\" is not an object file: %s", filename,
c4a081e1 938 bfd_errmsg (bfd_get_error ()));
ade40d31
RP
939 }
940
b52cac6b
FF
941 start_time = time (NULL);
942
ade40d31
RP
943 for (s = loadfile_bfd->sections; s; s = s->next)
944 {
945 if (s->flags & SEC_LOAD)
946 {
947 bfd_size_type size;
948
949 size = bfd_get_section_size_before_reloc (s);
950 if (size > 0)
951 {
952 char *buffer;
953 struct cleanup *old_chain;
954 bfd_vma vma;
955
b52cac6b
FF
956 data_count += size;
957
ade40d31
RP
958 buffer = xmalloc (size);
959 old_chain = make_cleanup (free, buffer);
960
961 vma = bfd_get_section_vma (loadfile_bfd, s);
962
963 /* Is this really necessary? I guess it gives the user something
964 to look at during a long download. */
c4a081e1 965 printf_filtered ("Loading section %s, size 0x%lx vma ",
ade40d31 966 bfd_get_section_name (loadfile_bfd, s),
c4a081e1 967 (unsigned long) size);
2e6784a8 968 print_address_numeric (vma, 1, gdb_stdout);
c4a081e1 969 printf_filtered ("\n");
ade40d31
RP
970
971 bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
972
973 target_write_memory (vma, buffer, size);
974
975 do_cleanups (old_chain);
976 }
977 }
978 }
979
b52cac6b
FF
980 end_time = time (NULL);
981
ade40d31
RP
982 /* We were doing this in remote-mips.c, I suspect it is right
983 for other targets too. */
984 write_pc (loadfile_bfd->start_address);
985
986 /* FIXME: are we supposed to call symbol_file_add or not? According to
987 a comment from remote-mips.c (where a call to symbol_file_add was
988 commented out), making the call confuses GDB if more than one file is
989 loaded in. remote-nindy.c had no call to symbol_file_add, but remote-vx.c
990 does. */
991
72158e71 992 report_transfer_performance (data_count, start_time, end_time);
b52cac6b 993
ade40d31
RP
994 do_cleanups (old_cleanups);
995}
996
72158e71
SS
997/* Report how fast the transfer went. */
998
999void
1000report_transfer_performance (data_count, start_time, end_time)
1001unsigned long data_count;
1002time_t start_time, end_time;
1003{
1004 printf_filtered ("Transfer rate: ");
1005 if (end_time != start_time)
1006 printf_filtered ("%d bits/sec",
1007 (data_count * 8) / (end_time - start_time));
1008 else
1009 printf_filtered ("%d bits in <1 sec", (data_count * 8));
1010 printf_filtered (".\n");
1011}
1012
61a7292f
SG
1013/* This function allows the addition of incrementally linked object files.
1014 It does not modify any state in the target, only in the debugger. */
bd5635a1 1015
e1ce8aa5 1016/* ARGSUSED */
30875e1c 1017static void
b0246b3b
FF
1018add_symbol_file_command (args, from_tty)
1019 char *args;
bd5635a1
RP
1020 int from_tty;
1021{
b0246b3b 1022 char *name = NULL;
bd5635a1 1023 CORE_ADDR text_addr;
b0246b3b 1024 char *arg;
ac88ca20
JG
1025 int readnow = 0;
1026 int mapped = 0;
bd5635a1 1027
b0246b3b 1028 dont_repeat ();
61a7292f 1029
b0246b3b
FF
1030 if (args == NULL)
1031 {
1032 error ("add-symbol-file takes a file name and an address");
1033 }
bd5635a1 1034
b0246b3b 1035 /* Make a copy of the string that we can safely write into. */
bd5635a1 1036
b0246b3b
FF
1037 args = strdup (args);
1038 make_cleanup (free, args);
1039
1040 /* Pick off any -option args and the file name. */
1041
1042 while ((*args != '\000') && (name == NULL))
1043 {
1044 while (isspace (*args)) {args++;}
1045 arg = args;
1046 while ((*args != '\000') && !isspace (*args)) {args++;}
1047 if (*args != '\000')
1048 {
1049 *args++ = '\000';
1050 }
1051 if (*arg != '-')
1052 {
1053 name = arg;
1054 }
2e4964ad 1055 else if (STREQ (arg, "-mapped"))
b0246b3b
FF
1056 {
1057 mapped = 1;
1058 }
2e4964ad 1059 else if (STREQ (arg, "-readnow"))
b0246b3b
FF
1060 {
1061 readnow = 1;
1062 }
1063 else
1064 {
1065 error ("unknown option `%s'", arg);
1066 }
1067 }
bd5635a1 1068
b0246b3b
FF
1069 /* After picking off any options and the file name, args should be
1070 left pointing at the remainder of the command line, which should
1071 be the address expression to evaluate. */
bd5635a1 1072
1340861c 1073 if (name == NULL)
b0246b3b 1074 {
1340861c 1075 error ("add-symbol-file takes a file name");
b0246b3b
FF
1076 }
1077 name = tilde_expand (name);
1078 make_cleanup (free, name);
bd5635a1 1079
1340861c
KH
1080 if (*args != '\000')
1081 {
1082 text_addr = parse_and_eval_address (args);
1083 }
1084 else
1085 {
1086 target_link(name, &text_addr);
1087 if (text_addr == (CORE_ADDR)-1)
1088 error("Don't know how to get text start location for this file");
1089 }
bd5635a1 1090
c4a081e1 1091 /* FIXME-32x64: Assumes text_addr fits in a long. */
d8ce1326 1092 if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n",
4d57c599 1093 name, local_hex_string ((unsigned long)text_addr)))
bd5635a1
RP
1094 error ("Not confirmed.");
1095
4ed3a9ea 1096 symbol_file_add (name, 0, text_addr, 0, mapped, readnow);
76212295
PS
1097
1098 /* Getting new symbols may change our opinion about what is
1099 frameless. */
1100 reinit_frame_cache ();
bd5635a1
RP
1101}
1102\f
f3806e3b
PS
1103static void
1104add_shared_symbol_files_command (args, from_tty)
1105 char *args;
1106 int from_tty;
1107{
1108#ifdef ADD_SHARED_SYMBOL_FILES
1109 ADD_SHARED_SYMBOL_FILES (args, from_tty);
1110#else
1111 error ("This command is not available in this configuration of GDB.");
1112#endif
1113}
1114\f
7d9884b9 1115/* Re-read symbols if a symbol-file has changed. */
bd5635a1
RP
1116void
1117reread_symbols ()
1118{
7d9884b9
JG
1119 struct objfile *objfile;
1120 long new_modtime;
1121 int reread_one = 0;
cba0d141
JG
1122 struct stat new_statbuf;
1123 int res;
bd5635a1
RP
1124
1125 /* With the addition of shared libraries, this should be modified,
1126 the load time should be saved in the partial symbol tables, since
1127 different tables may come from different source files. FIXME.
1128 This routine should then walk down each partial symbol table
30875e1c 1129 and see if the symbol table that it originates from has been changed */
bd5635a1 1130
7d9884b9
JG
1131 for (objfile = object_files; objfile; objfile = objfile->next) {
1132 if (objfile->obfd) {
1eeba686 1133#ifdef IBM6000_TARGET
318bf84f
FF
1134 /* If this object is from a shared library, then you should
1135 stat on the library name, not member name. */
1136
1137 if (objfile->obfd->my_archive)
1138 res = stat (objfile->obfd->my_archive->filename, &new_statbuf);
1139 else
1140#endif
cba0d141
JG
1141 res = stat (objfile->name, &new_statbuf);
1142 if (res != 0) {
1143 /* FIXME, should use print_sys_errmsg but it's not filtered. */
1144 printf_filtered ("`%s' has disappeared; keeping its symbols.\n",
1145 objfile->name);
1146 continue;
1147 }
1148 new_modtime = new_statbuf.st_mtime;
4d57c599
JK
1149 if (new_modtime != objfile->mtime)
1150 {
1151 struct cleanup *old_cleanups;
1152 struct section_offsets *offsets;
1153 int num_offsets;
1154 int section_offsets_size;
76212295 1155 char *obfd_filename;
4d57c599
JK
1156
1157 printf_filtered ("`%s' has changed; re-reading symbols.\n",
1158 objfile->name);
1159
1160 /* There are various functions like symbol_file_add,
1161 symfile_bfd_open, syms_from_objfile, etc., which might
1162 appear to do what we want. But they have various other
1163 effects which we *don't* want. So we just do stuff
1164 ourselves. We don't worry about mapped files (for one thing,
1165 any mapped file will be out of date). */
1166
1167 /* If we get an error, blow away this objfile (not sure if
1168 that is the correct response for things like shared
1169 libraries). */
1170 old_cleanups = make_cleanup (free_objfile, objfile);
1171 /* We need to do this whenever any symbols go away. */
1172 make_cleanup (clear_symtab_users, 0);
1173
1174 /* Clean up any state BFD has sitting around. We don't need
1175 to close the descriptor but BFD lacks a way of closing the
1176 BFD without closing the descriptor. */
76212295 1177 obfd_filename = bfd_get_filename (objfile->obfd);
4d57c599 1178 if (!bfd_close (objfile->obfd))
1a494973
C
1179 error ("Can't close BFD for %s: %s", objfile->name,
1180 bfd_errmsg (bfd_get_error ()));
76212295 1181 objfile->obfd = bfd_openr (obfd_filename, gnutarget);
4d57c599
JK
1182 if (objfile->obfd == NULL)
1183 error ("Can't open %s to read symbols.", objfile->name);
1184 /* bfd_openr sets cacheable to true, which is what we want. */
1185 if (!bfd_check_format (objfile->obfd, bfd_object))
1186 error ("Can't read symbols from %s: %s.", objfile->name,
c4a081e1 1187 bfd_errmsg (bfd_get_error ()));
4d57c599
JK
1188
1189 /* Save the offsets, we will nuke them with the rest of the
1190 psymbol_obstack. */
1191 num_offsets = objfile->num_sections;
1192 section_offsets_size =
1193 sizeof (struct section_offsets)
1194 + sizeof (objfile->section_offsets->offsets) * num_offsets;
1195 offsets = (struct section_offsets *) alloca (section_offsets_size);
1196 memcpy (offsets, objfile->section_offsets, section_offsets_size);
1197
1198 /* Nuke all the state that we will re-read. Much of the following
1199 code which sets things to NULL really is necessary to tell
1200 other parts of GDB that there is nothing currently there. */
1201
1202 /* FIXME: Do we have to free a whole linked list, or is this
1203 enough? */
1204 if (objfile->global_psymbols.list)
1205 mfree (objfile->md, objfile->global_psymbols.list);
b52cac6b
FF
1206 memset (&objfile -> global_psymbols, 0,
1207 sizeof (objfile -> global_psymbols));
4d57c599
JK
1208 if (objfile->static_psymbols.list)
1209 mfree (objfile->md, objfile->static_psymbols.list);
b52cac6b
FF
1210 memset (&objfile -> static_psymbols, 0,
1211 sizeof (objfile -> static_psymbols));
4d57c599
JK
1212
1213 /* Free the obstacks for non-reusable objfiles */
2ad5709f 1214 obstack_free (&objfile -> psymbol_cache.cache, 0);
b52cac6b
FF
1215 memset (&objfile -> psymbol_cache, 0,
1216 sizeof (objfile -> psymbol_cache));
4d57c599
JK
1217 obstack_free (&objfile -> psymbol_obstack, 0);
1218 obstack_free (&objfile -> symbol_obstack, 0);
1219 obstack_free (&objfile -> type_obstack, 0);
1220 objfile->sections = NULL;
1221 objfile->symtabs = NULL;
1222 objfile->psymtabs = NULL;
1223 objfile->free_psymtabs = NULL;
1224 objfile->msymbols = NULL;
1225 objfile->minimal_symbol_count= 0;
1226 objfile->fundamental_types = NULL;
1227 if (objfile -> sf != NULL)
1228 {
1229 (*objfile -> sf -> sym_finish) (objfile);
1230 }
1231
1232 /* We never make this a mapped file. */
1233 objfile -> md = NULL;
1234 /* obstack_specify_allocation also initializes the obstack so
1235 it is empty. */
2ad5709f
FF
1236 obstack_specify_allocation (&objfile -> psymbol_cache.cache, 0, 0,
1237 xmalloc, free);
4d57c599
JK
1238 obstack_specify_allocation (&objfile -> psymbol_obstack, 0, 0,
1239 xmalloc, free);
1240 obstack_specify_allocation (&objfile -> symbol_obstack, 0, 0,
1241 xmalloc, free);
1242 obstack_specify_allocation (&objfile -> type_obstack, 0, 0,
1243 xmalloc, free);
1244 if (build_objfile_section_table (objfile))
1245 {
1246 error ("Can't find the file sections in `%s': %s",
c4a081e1 1247 objfile -> name, bfd_errmsg (bfd_get_error ()));
4d57c599
JK
1248 }
1249
1250 /* We use the same section offsets as from last time. I'm not
1251 sure whether that is always correct for shared libraries. */
1252 objfile->section_offsets = (struct section_offsets *)
1253 obstack_alloc (&objfile -> psymbol_obstack, section_offsets_size);
1254 memcpy (objfile->section_offsets, offsets, section_offsets_size);
1255 objfile->num_sections = num_offsets;
1256
1257 /* What the hell is sym_new_init for, anyway? The concept of
1258 distinguishing between the main file and additional files
1259 in this way seems rather dubious. */
1260 if (objfile == symfile_objfile)
1261 (*objfile->sf->sym_new_init) (objfile);
1262
1263 (*objfile->sf->sym_init) (objfile);
1264 clear_complaints (1, 1);
1265 /* The "mainline" parameter is a hideous hack; I think leaving it
1266 zero is OK since dbxread.c also does what it needs to do if
1267 objfile->global_psymbols.size is 0. */
1268 (*objfile->sf->sym_read) (objfile, objfile->section_offsets, 0);
f3806e3b
PS
1269 if (!have_partial_symbols () && !have_full_symbols ())
1270 {
1271 wrap_here ("");
1272 printf_filtered ("(no debugging symbols found)\n");
1273 wrap_here ("");
1274 }
4d57c599
JK
1275 objfile -> flags |= OBJF_SYMS;
1276
1277 /* We're done reading the symbol file; finish off complaints. */
1278 clear_complaints (0, 1);
1279
1280 /* Getting new symbols may change our opinion about what is
1281 frameless. */
1282
1283 reinit_frame_cache ();
1284
1285 /* Discard cleanups as symbol reading was successful. */
1286 discard_cleanups (old_cleanups);
1287
1288 /* If the mtime has changed between the time we set new_modtime
1289 and now, we *want* this to be out of date, so don't call stat
1290 again now. */
1291 objfile->mtime = new_modtime;
1292 reread_one = 1;
dee7a11c
FF
1293
1294 /* Call this after reading in a new symbol table to give target
1295 dependant code a crack at the new symbols. For instance, this
1296 could be used to update the values of target-specific symbols GDB
1297 needs to keep track of (such as _sigtramp, or whatever). */
1298
1299 TARGET_SYMFILE_POSTREAD (objfile);
4d57c599 1300 }
bd5635a1 1301 }
7d9884b9
JG
1302 }
1303
1304 if (reread_one)
4d57c599 1305 clear_symtab_users ();
bd5635a1 1306}
bd5635a1 1307
bd5635a1 1308\f
7d9884b9
JG
1309enum language
1310deduce_language_from_filename (filename)
1311 char *filename;
1312{
2093fe68 1313 char *c;
7d9884b9 1314
2093fe68
RP
1315 if (0 == filename)
1316 ; /* Get default */
1317 else if (0 == (c = strrchr (filename, '.')))
1318 ; /* Get default. */
f3806e3b 1319 else if (STREQ (c, ".c"))
2093fe68 1320 return language_c;
f3806e3b 1321 else if (STREQ (c, ".cc") || STREQ (c, ".C") || STREQ (c, ".cxx")
1a494973 1322 || STREQ (c, ".cpp") || STREQ (c, ".cp") || STREQ (c, ".c++"))
2093fe68 1323 return language_cplus;
f3806e3b 1324 else if (STREQ (c, ".ch") || STREQ (c, ".c186") || STREQ (c, ".c286"))
2093fe68 1325 return language_chill;
76212295
PS
1326 else if (STREQ (c, ".f") || STREQ (c, ".F"))
1327 return language_fortran;
f3806e3b
PS
1328 else if (STREQ (c, ".mod"))
1329 return language_m2;
1330 else if (STREQ (c, ".s") || STREQ (c, ".S"))
1331 return language_asm;
7d9884b9
JG
1332
1333 return language_unknown; /* default */
1334}
1335\f
d8ce1326
JG
1336/* allocate_symtab:
1337
1338 Allocate and partly initialize a new symbol table. Return a pointer
1339 to it. error() if no space.
1340
1341 Caller must set these fields:
1342 LINETABLE(symtab)
1343 symtab->blockvector
d8ce1326
JG
1344 symtab->dirname
1345 symtab->free_code
1346 symtab->free_ptr
1347 initialize any EXTRA_SYMTAB_INFO
1348 possibly free_named_symtabs (symtab->filename);
d8ce1326
JG
1349 */
1350
1351struct symtab *
30875e1c
SG
1352allocate_symtab (filename, objfile)
1353 char *filename;
1354 struct objfile *objfile;
d8ce1326
JG
1355{
1356 register struct symtab *symtab;
d8ce1326 1357
30875e1c
SG
1358 symtab = (struct symtab *)
1359 obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symtab));
4ed3a9ea 1360 memset (symtab, 0, sizeof (*symtab));
30875e1c
SG
1361 symtab -> filename = obsavestring (filename, strlen (filename),
1362 &objfile -> symbol_obstack);
1363 symtab -> fullname = NULL;
1364 symtab -> language = deduce_language_from_filename (filename);
d8ce1326 1365
7d9884b9 1366 /* Hook it to the objfile it comes from */
30875e1c
SG
1367
1368 symtab -> objfile = objfile;
1369 symtab -> next = objfile -> symtabs;
1370 objfile -> symtabs = symtab;
7d9884b9
JG
1371
1372#ifdef INIT_EXTRA_SYMTAB_INFO
30875e1c 1373 INIT_EXTRA_SYMTAB_INFO (symtab);
7d9884b9 1374#endif
d8ce1326 1375
30875e1c 1376 return (symtab);
d8ce1326 1377}
30875e1c
SG
1378
1379struct partial_symtab *
1380allocate_psymtab (filename, objfile)
1381 char *filename;
1382 struct objfile *objfile;
1383{
1384 struct partial_symtab *psymtab;
1385
cba0d141
JG
1386 if (objfile -> free_psymtabs)
1387 {
1388 psymtab = objfile -> free_psymtabs;
1389 objfile -> free_psymtabs = psymtab -> next;
1390 }
1391 else
1392 psymtab = (struct partial_symtab *)
1393 obstack_alloc (&objfile -> psymbol_obstack,
1394 sizeof (struct partial_symtab));
1395
4ed3a9ea 1396 memset (psymtab, 0, sizeof (struct partial_symtab));
30875e1c
SG
1397 psymtab -> filename = obsavestring (filename, strlen (filename),
1398 &objfile -> psymbol_obstack);
1399 psymtab -> symtab = NULL;
1400
1401 /* Hook it to the objfile it comes from */
1402
1403 psymtab -> objfile = objfile;
1404 psymtab -> next = objfile -> psymtabs;
1405 objfile -> psymtabs = psymtab;
1406
1407 return (psymtab);
1408}
1409
d8ce1326 1410\f
ade40d31
RP
1411/* Reset all data structures in gdb which may contain references to symbol
1412 table date. */
1413
1414void
1415clear_symtab_users ()
1416{
1417 /* Someday, we should do better than this, by only blowing away
1418 the things that really need to be blown. */
1419 clear_value_history ();
1420 clear_displays ();
1421 clear_internalvars ();
1422 breakpoint_re_set ();
1423 set_default_breakpoint (0, 0, 0, 0);
1424 current_source_symtab = 0;
1425 current_source_line = 0;
4d57c599 1426 clear_pc_function_cache ();
ade40d31
RP
1427}
1428
9d199712
JG
1429/* clear_symtab_users_once:
1430
1431 This function is run after symbol reading, or from a cleanup.
1432 If an old symbol table was obsoleted, the old symbol table
1433 has been blown away, but the other GDB data structures that may
1434 reference it have not yet been cleared or re-directed. (The old
1435 symtab was zapped, and the cleanup queued, in free_named_symtab()
1436 below.)
1437
1438 This function can be queued N times as a cleanup, or called
1439 directly; it will do all the work the first time, and then will be a
1440 no-op until the next time it is queued. This works by bumping a
1441 counter at queueing time. Much later when the cleanup is run, or at
1442 the end of symbol processing (in case the cleanup is discarded), if
1443 the queued count is greater than the "done-count", we do the work
1444 and set the done-count to the queued count. If the queued count is
1445 less than or equal to the done-count, we just ignore the call. This
1446 is needed because reading a single .o file will often replace many
1447 symtabs (one per .h file, for example), and we don't want to reset
1448 the breakpoints N times in the user's face.
1449
1450 The reason we both queue a cleanup, and call it directly after symbol
1451 reading, is because the cleanup protects us in case of errors, but is
1452 discarded if symbol reading is successful. */
1453
ade40d31 1454#if 0
996ccb30
JK
1455/* FIXME: As free_named_symtabs is currently a big noop this function
1456 is no longer needed. */
ade40d31
RP
1457static void
1458clear_symtab_users_once PARAMS ((void));
1459
9d199712
JG
1460static int clear_symtab_users_queued;
1461static int clear_symtab_users_done;
1462
ade40d31 1463static void
9d199712
JG
1464clear_symtab_users_once ()
1465{
1466 /* Enforce once-per-`do_cleanups'-semantics */
1467 if (clear_symtab_users_queued <= clear_symtab_users_done)
1468 return;
1469 clear_symtab_users_done = clear_symtab_users_queued;
1470
ade40d31 1471 clear_symtab_users ();
9d199712 1472}
ade40d31 1473#endif
9d199712
JG
1474
1475/* Delete the specified psymtab, and any others that reference it. */
1476
e1ce8aa5 1477static void
9d199712
JG
1478cashier_psymtab (pst)
1479 struct partial_symtab *pst;
1480{
46c28185 1481 struct partial_symtab *ps, *pprev = NULL;
9d199712
JG
1482 int i;
1483
1484 /* Find its previous psymtab in the chain */
30875e1c 1485 for (ps = pst->objfile->psymtabs; ps; ps = ps->next) {
9d199712
JG
1486 if (ps == pst)
1487 break;
1488 pprev = ps;
1489 }
1490
1491 if (ps) {
1492 /* Unhook it from the chain. */
30875e1c
SG
1493 if (ps == pst->objfile->psymtabs)
1494 pst->objfile->psymtabs = ps->next;
9d199712
JG
1495 else
1496 pprev->next = ps->next;
1497
1498 /* FIXME, we can't conveniently deallocate the entries in the
1499 partial_symbol lists (global_psymbols/static_psymbols) that
1500 this psymtab points to. These just take up space until all
1501 the psymtabs are reclaimed. Ditto the dependencies list and
1502 filename, which are all in the psymbol_obstack. */
1503
1504 /* We need to cashier any psymtab that has this one as a dependency... */
1505again:
30875e1c 1506 for (ps = pst->objfile->psymtabs; ps; ps = ps->next) {
9d199712
JG
1507 for (i = 0; i < ps->number_of_dependencies; i++) {
1508 if (ps->dependencies[i] == pst) {
1509 cashier_psymtab (ps);
1510 goto again; /* Must restart, chain has been munged. */
1511 }
1512 }
1513 }
1514 }
1515}
1516
1517/* If a symtab or psymtab for filename NAME is found, free it along
1518 with any dependent breakpoints, displays, etc.
1519 Used when loading new versions of object modules with the "add-file"
1520 command. This is only called on the top-level symtab or psymtab's name;
1521 it is not called for subsidiary files such as .h files.
1522
1523 Return value is 1 if we blew away the environment, 0 if not.
30875e1c 1524 FIXME. The return valu appears to never be used.
9d199712
JG
1525
1526 FIXME. I think this is not the best way to do this. We should
1527 work on being gentler to the environment while still cleaning up
1528 all stray pointers into the freed symtab. */
1529
1530int
1531free_named_symtabs (name)
1532 char *name;
1533{
30875e1c
SG
1534#if 0
1535 /* FIXME: With the new method of each objfile having it's own
1536 psymtab list, this function needs serious rethinking. In particular,
1537 why was it ever necessary to toss psymtabs with specific compilation
1538 unit filenames, as opposed to all psymtabs from a particular symbol
ac88ca20
JG
1539 file? -- fnf
1540 Well, the answer is that some systems permit reloading of particular
1541 compilation units. We want to blow away any old info about these
1542 compilation units, regardless of which objfiles they arrived in. --gnu. */
1543
1544 register struct symtab *s;
1545 register struct symtab *prev;
1546 register struct partial_symtab *ps;
1547 struct blockvector *bv;
1548 int blewit = 0;
30875e1c 1549
61a7292f
SG
1550 /* We only wack things if the symbol-reload switch is set. */
1551 if (!symbol_reloading)
1552 return 0;
1553
d11c44f1
JG
1554 /* Some symbol formats have trouble providing file names... */
1555 if (name == 0 || *name == '\0')
1556 return 0;
1557
9d199712
JG
1558 /* Look for a psymtab with the specified name. */
1559
1560again2:
1561 for (ps = partial_symtab_list; ps; ps = ps->next) {
2e4964ad 1562 if (STREQ (name, ps->filename)) {
9d199712
JG
1563 cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
1564 goto again2; /* Must restart, chain has been munged */
1565 }
1566 }
1567
1568 /* Look for a symtab with the specified name. */
1569
1570 for (s = symtab_list; s; s = s->next)
1571 {
2e4964ad 1572 if (STREQ (name, s->filename))
9d199712
JG
1573 break;
1574 prev = s;
1575 }
1576
1577 if (s)
1578 {
1579 if (s == symtab_list)
1580 symtab_list = s->next;
1581 else
1582 prev->next = s->next;
1583
1584 /* For now, queue a delete for all breakpoints, displays, etc., whether
1585 or not they depend on the symtab being freed. This should be
1586 changed so that only those data structures affected are deleted. */
1587
1588 /* But don't delete anything if the symtab is empty.
1589 This test is necessary due to a bug in "dbxread.c" that
1590 causes empty symtabs to be created for N_SO symbols that
1591 contain the pathname of the object file. (This problem
1592 has been fixed in GDB 3.9x). */
1593
c9bd6710
JG
1594 bv = BLOCKVECTOR (s);
1595 if (BLOCKVECTOR_NBLOCKS (bv) > 2
9d199712
JG
1596 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
1597 || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)))
1598 {
1599 complain (&oldsyms_complaint, name);
1600
1601 clear_symtab_users_queued++;
1602 make_cleanup (clear_symtab_users_once, 0);
1603 blewit = 1;
1604 } else {
1605 complain (&empty_symtab_complaint, name);
1606 }
1607
1608 free_symtab (s);
1609 }
1610 else
d8ce1326
JG
1611 {
1612 /* It is still possible that some breakpoints will be affected
1613 even though no symtab was found, since the file might have
1614 been compiled without debugging, and hence not be associated
1615 with a symtab. In order to handle this correctly, we would need
1616 to keep a list of text address ranges for undebuggable files.
1617 For now, we do nothing, since this is a fairly obscure case. */
1618 ;
1619 }
9d199712 1620
30875e1c 1621 /* FIXME, what about the minimal symbol table? */
9d199712 1622 return blewit;
30875e1c
SG
1623#else
1624 return (0);
1625#endif
9d199712
JG
1626}
1627\f
d4ea2aba
PB
1628/* Allocate and partially fill a partial symtab. It will be
1629 completely filled at the end of the symbol list.
1630
1631 SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
1632 is the address relative to which its symbols are (incremental) or 0
1633 (normal). */
1634
1635
1636struct partial_symtab *
a8e033f2 1637start_psymtab_common (objfile, section_offsets,
d4ea2aba
PB
1638 filename, textlow, global_syms, static_syms)
1639 struct objfile *objfile;
a8e033f2 1640 struct section_offsets *section_offsets;
d4ea2aba
PB
1641 char *filename;
1642 CORE_ADDR textlow;
2ad5709f
FF
1643 struct partial_symbol **global_syms;
1644 struct partial_symbol **static_syms;
d4ea2aba 1645{
30875e1c
SG
1646 struct partial_symtab *psymtab;
1647
1648 psymtab = allocate_psymtab (filename, objfile);
a8e033f2 1649 psymtab -> section_offsets = section_offsets;
30875e1c
SG
1650 psymtab -> textlow = textlow;
1651 psymtab -> texthigh = psymtab -> textlow; /* default */
1652 psymtab -> globals_offset = global_syms - objfile -> global_psymbols.list;
1653 psymtab -> statics_offset = static_syms - objfile -> static_psymbols.list;
1654 return (psymtab);
7d9884b9 1655}
9342ecb9
JG
1656\f
1657/* Debugging versions of functions that are usually inline macros
1658 (see symfile.h). */
1659
2e4964ad 1660#if !INLINE_ADD_PSYMBOL
9342ecb9
JG
1661
1662/* Add a symbol with a long value to a psymtab.
1663 Since one arg is a struct, we pass in a ptr and deref it (sigh). */
1664
1665void
2e4964ad
FF
1666add_psymbol_to_list (name, namelength, namespace, class, list, val, language,
1667 objfile)
9342ecb9
JG
1668 char *name;
1669 int namelength;
1750a5ef 1670 namespace_enum namespace;
9342ecb9
JG
1671 enum address_class class;
1672 struct psymbol_allocation_list *list;
1673 long val;
2e4964ad
FF
1674 enum language language;
1675 struct objfile *objfile;
9342ecb9 1676{
2e4964ad 1677 register struct partial_symbol *psym;
2ad5709f
FF
1678 char *buf = alloca (namelength + 1);
1679 struct partial_symbol psymbol;
1680
1681 /* Create local copy of the partial symbol */
1682 memcpy (buf, name, namelength);
1683 buf[namelength] = '\0';
1684 SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
1685 SYMBOL_VALUE (&psymbol) = val;
1686 SYMBOL_SECTION (&psymbol) = 0;
1687 SYMBOL_LANGUAGE (&psymbol) = language;
1688 PSYMBOL_NAMESPACE (&psymbol) = namespace;
1689 PSYMBOL_CLASS (&psymbol) = class;
1690 SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
1691
1692 /* Stash the partial symbol away in the cache */
1693 psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache);
1694
1695 /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
2e4964ad
FF
1696 if (list->next >= list->list + list->size)
1697 {
2ad5709f 1698 extend_psymbol_list (list, objfile);
2e4964ad 1699 }
2ad5709f 1700 *list->next++ = psym;
f1d39876 1701 OBJSTAT (objfile, n_psyms++);
9342ecb9
JG
1702}
1703
1704/* Add a symbol with a CORE_ADDR value to a psymtab. */
1705
1706void
2e4964ad
FF
1707add_psymbol_addr_to_list (name, namelength, namespace, class, list, val,
1708 language, objfile)
9342ecb9
JG
1709 char *name;
1710 int namelength;
1750a5ef 1711 namespace_enum namespace;
9342ecb9
JG
1712 enum address_class class;
1713 struct psymbol_allocation_list *list;
1714 CORE_ADDR val;
2e4964ad
FF
1715 enum language language;
1716 struct objfile *objfile;
9342ecb9 1717{
2e4964ad 1718 register struct partial_symbol *psym;
2ad5709f
FF
1719 char *buf = alloca (namelength + 1);
1720 struct partial_symbol psymbol;
1721
1722 /* Create local copy of the partial symbol */
1723 memcpy (buf, name, namelength);
1724 buf[namelength] = '\0';
1725 SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache);
1726 SYMBOL_VALUE_ADDRESS (&psymbol) = val;
1727 SYMBOL_SECTION (&psymbol) = 0;
1728 SYMBOL_LANGUAGE (&psymbol) = language;
1729 PSYMBOL_NAMESPACE (&psymbol) = namespace;
1730 PSYMBOL_CLASS (&psymbol) = class;
1731 SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
1732
1733 /* Stash the partial symbol away in the cache */
1734 psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache);
1735
1736 /* Save pointer to partial symbol in psymtab, growing symtab if needed. */
2e4964ad
FF
1737 if (list->next >= list->list + list->size)
1738 {
2ad5709f 1739 extend_psymbol_list (list, objfile);
2e4964ad 1740 }
2ad5709f 1741 *list->next++ = psym;
f1d39876 1742 OBJSTAT (objfile, n_psyms++);
9342ecb9 1743}
7d9884b9 1744
2e4964ad
FF
1745#endif /* !INLINE_ADD_PSYMBOL */
1746
1a494973
C
1747/* Initialize storage for partial symbols. */
1748
1749void
1750init_psymbol_list (objfile, total_symbols)
1751 struct objfile *objfile;
1752 int total_symbols;
1753{
1754 /* Free any previously allocated psymbol lists. */
1755
1756 if (objfile -> global_psymbols.list)
1757 {
1758 mfree (objfile -> md, (PTR)objfile -> global_psymbols.list);
1759 }
1760 if (objfile -> static_psymbols.list)
1761 {
1762 mfree (objfile -> md, (PTR)objfile -> static_psymbols.list);
1763 }
1764
1765 /* Current best guess is that approximately a twentieth
1766 of the total symbols (in a debugging file) are global or static
1767 oriented symbols */
1768
1769 objfile -> global_psymbols.size = total_symbols / 10;
1770 objfile -> static_psymbols.size = total_symbols / 10;
1771 objfile -> global_psymbols.next =
2ad5709f 1772 objfile -> global_psymbols.list = (struct partial_symbol **)
1a494973 1773 xmmalloc (objfile -> md, objfile -> global_psymbols.size
2ad5709f 1774 * sizeof (struct partial_symbol *));
1a494973 1775 objfile -> static_psymbols.next =
2ad5709f 1776 objfile -> static_psymbols.list = (struct partial_symbol **)
1a494973 1777 xmmalloc (objfile -> md, objfile -> static_psymbols.size
2ad5709f 1778 * sizeof (struct partial_symbol *));
1a494973 1779}
7d9884b9 1780\f
bd5635a1
RP
1781void
1782_initialize_symfile ()
1783{
ade40d31
RP
1784 struct cmd_list_element *c;
1785
1786 c = add_cmd ("symbol-file", class_files, symbol_file_command,
30875e1c 1787 "Load symbol table from executable file FILE.\n\
bd5635a1 1788The `file' command can also load symbol tables, as well as setting the file\n\
ade40d31
RP
1789to execute.", &cmdlist);
1790 c->completer = filename_completer;
bd5635a1 1791
ade40d31 1792 c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command,
f3806e3b
PS
1793 "Usage: add-symbol-file FILE ADDR\n\
1794Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\
1795ADDR is the starting address of the file's text.",
ade40d31
RP
1796 &cmdlist);
1797 c->completer = filename_completer;
bd5635a1 1798
f3806e3b
PS
1799 c = add_cmd ("add-shared-symbol-files", class_files,
1800 add_shared_symbol_files_command,
1801 "Load the symbols from shared objects in the dynamic linker's link map.",
1802 &cmdlist);
1803 c = add_alias_cmd ("assf", "add-shared-symbol-files", class_files, 1,
1804 &cmdlist);
1805
ade40d31 1806 c = add_cmd ("load", class_files, load_command,
bd5635a1 1807 "Dynamically load FILE into the running program, and record its symbols\n\
ade40d31
RP
1808for access from GDB.", &cmdlist);
1809 c->completer = filename_completer;
bd5635a1 1810
61a7292f
SG
1811 add_show_from_set
1812 (add_set_cmd ("symbol-reloading", class_support, var_boolean,
1813 (char *)&symbol_reloading,
1814 "Set dynamic symbol table reloading multiple times in one run.",
1815 &setlist),
1816 &showlist);
1817
bd5635a1 1818}
This page took 0.363522 seconds and 4 git commands to generate.