1 /* Read hp debug symbols and convert to internal format, for GDB.
2 Copyright 1993, 1996, 1998, 1999 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 Written by the Center for Software Science at the University of Utah
21 and by Cygnus Support. */
23 /* Common include file for hp_symtab_read.c and hp_psymtab_read.c.
24 This has nested includes of a bunch of stuff. */
28 /* To generate dumping code, uncomment this define. The dumping
29 itself is controlled by routine-local statics called "dumping". */
30 /* #define DUMPING 1 */
32 /* To use the quick look-up tables, uncomment this define. */
33 #define QUICK_LOOK_UP 0
35 /* To call PXDB to process un-processed files, uncomment this define. */
38 /* Forward procedure declarations */
40 void hpread_symfile_init
41 PARAMS ((struct objfile *));
43 void hpread_build_psymtabs
44 PARAMS ((struct objfile *, struct section_offsets *, int));
46 void hpread_symfile_finish
47 PARAMS ((struct objfile *));
49 static union dnttentry *hpread_get_gntt
50 PARAMS ((int, struct objfile *));
52 static unsigned long hpread_get_textlow
53 PARAMS ((int, int, struct objfile *, int));
55 static struct partial_symtab *hpread_start_psymtab
56 PARAMS ((struct objfile *, struct section_offsets *, char *, CORE_ADDR, int,
57 struct partial_symbol **, struct partial_symbol **));
59 static struct partial_symtab *hpread_end_psymtab
60 PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
61 struct partial_symtab **, int));
63 /* End of forward routine declarations */
67 /* NOTE use of system files! May not be portable. */
69 #define PXDB_SVR4 "/opt/langtools/bin/pxdb"
70 #define PXDB_BSD "/usr/bin/pxdb"
76 /* check for the existance of a file, given its full pathname */
78 file_exists (filename)
82 return (access (filename, F_OK) == 0);
87 /* Translate from the "hp_language" enumeration in hp-symtab.h
88 used in the debug info to gdb's generic enumeration in defs.h. */
91 enum hp_language in_lang;
93 if (in_lang == HP_LANGUAGE_C)
96 else if (in_lang == HP_LANGUAGE_CPLUSPLUS)
97 return language_cplus;
99 else if (in_lang == HP_LANGUAGE_F77)
100 return language_fortran;
103 return language_unknown;
106 static char main_string[] = "main";
108 /* Call PXDB to process our file.
110 Approach copied from DDE's "dbgk_run_pxdb". Note: we
111 don't check for BSD location of pxdb, nor for existance
114 NOTE: uses system function and string functions directly.
116 Return value: 1 if ok, 0 if not */
118 hpread_call_pxdb (file_name)
125 if (file_exists (PXDB_SVR4))
127 p = malloc (strlen (PXDB_SVR4) + strlen (file_name) + 2);
128 strcpy (p, PXDB_SVR4);
130 strcat (p, file_name);
132 warning ("File not processed by pxdb--about to process now.\n");
135 retval = (status == 0);
139 warning ("pxdb not found at standard location: /opt/langtools/bin\ngdb will not be able to debug %s.\nPlease install pxdb at the above location and then restart gdb.\nYou can also run pxdb on %s with the command\n\"pxdb %s\" and then restart gdb.", file_name, file_name, file_name);
144 } /* hpread_call_pxdb */
147 /* Return 1 if the file turns out to need pre-processing
148 by PXDB, and we have thus called PXDB to do this processing
149 and the file therefore needs to be re-loaded. Otherwise
152 hpread_pxdb_needed (sym_bfd)
155 asection *pinfo_section, *debug_section, *header_section;
156 unsigned int do_pxdb;
158 bfd_size_type header_section_size;
163 header_section = bfd_get_section_by_name (sym_bfd, "$HEADER$");
166 return 0; /* No header at all, can't recover... */
169 debug_section = bfd_get_section_by_name (sym_bfd, "$DEBUG$");
170 pinfo_section = bfd_get_section_by_name (sym_bfd, "$PINFO$");
172 if (pinfo_section && !debug_section)
174 /* Debug info with DOC, has different header format.
175 this only happens if the file was pxdbed and compiled optimized
176 otherwise the PINFO section is not there. */
177 header_section_size = bfd_section_size (objfile->obfd, header_section);
179 if (header_section_size == (bfd_size_type) sizeof (DOC_info_PXDB_header))
181 buf = alloca (sizeof (DOC_info_PXDB_header));
183 if (!bfd_get_section_contents (sym_bfd,
186 header_section_size))
187 error ("bfd_get_section_contents\n");
189 tmp = bfd_get_32 (sym_bfd, (bfd_byte *) (buf + sizeof (int) * 4));
190 pxdbed = (tmp >> 31) & 0x1;
193 error ("file debug header info invalid\n");
198 error ("invalid $HEADER$ size in executable \n");
204 /* this can be three different cases:
205 1. pxdbed and not doc
206 - DEBUG and HEADER sections are there
207 - header is PXDB_header type
208 - pxdbed flag is set to 1
210 2. not pxdbed and doc
211 - DEBUG and HEADER sections are there
212 - header is DOC_info_header type
213 - pxdbed flag is set to 0
215 3. not pxdbed and not doc
216 - DEBUG and HEADER sections are there
217 - header is XDB_header type
218 - pxdbed flag is set to 0
220 NOTE: the pxdbed flag is meaningful also in the not
221 already pxdb processed version of the header,
222 because in case on non-already processed by pxdb files
223 that same bit in the header would be always zero.
224 Why? Because the bit is the leftmost bit of a word
225 which contains a 'length' which is always a positive value
226 so that bit is never set to 1 (otherwise it would be negative)
228 Given the above, we have two choices : either we ignore the
229 size of the header itself and just look at the pxdbed field,
230 or we check the size and then we (for safety and paranoia related
231 issues) check the bit.
232 The first solution is used by DDE, the second by PXDB itself.
233 I am using the second one here, because I already wrote it,
234 and it is the end of a long day.
235 Also, using the first approach would still involve size issues
236 because we need to read in the contents of the header section, and
237 give the correct amount of stuff we want to read to the
238 get_bfd_section_contents function. */
240 /* decide which case depending on the size of the header section.
241 The size is as defined in hp-symtab.h */
243 header_section_size = bfd_section_size (objfile->obfd, header_section);
245 if (header_section_size == (bfd_size_type) sizeof (PXDB_header)) /* pxdb and not doc */
248 buf = alloca (sizeof (PXDB_header));
249 if (!bfd_get_section_contents (sym_bfd,
252 header_section_size))
253 error ("bfd_get_section_contents\n");
255 tmp = bfd_get_32 (sym_bfd, (bfd_byte *) (buf + sizeof (int) * 3));
256 pxdbed = (tmp >> 31) & 0x1;
261 error ("file debug header invalid\n");
263 else /*not pxdbed and doc OR not pxdbed and non doc */
275 } /* hpread_pxdb_needed */
281 /* This flag can be set to zero to use the old
282 style psymtab (build from a scan of the LNTT)
283 or to one to try to use the quick look-up
285 int psym_new_style = 1;
289 /* Code to handle quick lookup-tables follows */
292 /* Some useful macros */
293 #define VALID_FILE(i) ((i) < pxdb_header_p->fd_entries)
294 #define VALID_MODULE(i) ((i) < pxdb_header_p->md_entries)
295 #define VALID_PROC(i) ((i) < pxdb_header_p->pd_entries)
296 #define VALID_CLASS(i) ((i) < pxdb_header_p->cd_entries)
298 #define FILE_START(i) (qFD[i].adrStart)
299 #define MODULE_START(i) (qMD[i].adrStart)
300 #define PROC_START(i) (qPD[i].adrStart)
302 #define FILE_END(i) (qFD[i].adrEnd)
303 #define MODULE_END(i) (qMD[i].adrEnd)
304 #define PROC_END(i) (qPD[i].adrEnd)
306 #define FILE_ISYM(i) (qFD[i].isym)
307 #define MODULE_ISYM(i) (qMD[i].isym)
308 #define PROC_ISYM(i) (qPD[i].isym)
310 #define VALID_CURR_FILE (curr_fd < pxdb_header_p->fd_entries)
311 #define VALID_CURR_MODULE (curr_md < pxdb_header_p->md_entries)
312 #define VALID_CURR_PROC (curr_pd < pxdb_header_p->pd_entries)
313 #define VALID_CURR_CLASS (curr_cd < pxdb_header_p->cd_entries)
315 #define CURR_FILE_START (qFD[curr_fd].adrStart)
316 #define CURR_MODULE_START (qMD[curr_md].adrStart)
317 #define CURR_PROC_START (qPD[curr_pd].adrStart)
319 #define CURR_FILE_END (qFD[curr_fd].adrEnd)
320 #define CURR_MODULE_END (qMD[curr_md].adrEnd)
321 #define CURR_PROC_END (qPD[curr_pd].adrEnd)
323 #define CURR_FILE_ISYM (qFD[curr_fd].isym)
324 #define CURR_MODULE_ISYM (qMD[curr_md].isym)
325 #define CURR_PROC_ISYM (qPD[curr_pd].isym)
327 #define TELL_OBJFILE \
329 if( !told_objfile ) { \
331 warning ("\nIn object file \"%s\":\n", \
338 /* Keeping track of the start/end symbol table (LNTT) indices of
339 psymtabs created so far */
348 static pst_syms_struct *pst_syms_array = 0;
350 static pst_syms_count = 0;
351 static pst_syms_size = 0;
353 /* used by the TELL_OBJFILE macro */
354 static boolean told_objfile = 0;
356 /* Set up psymtab symbol index stuff */
362 pst_syms_array = (pst_syms_struct *) xmalloc (20 * sizeof (pst_syms_struct));
365 /* Clean up psymtab symbol index stuff */
371 free (pst_syms_array);
375 /* Add information about latest psymtab to symbol index table */
377 record_pst_syms (start_sym, end_sym)
381 if (++pst_syms_count > pst_syms_size)
383 pst_syms_array = (pst_syms_struct *) xrealloc (pst_syms_array,
384 2 * pst_syms_size * sizeof (pst_syms_struct));
387 pst_syms_array[pst_syms_count - 1].start = start_sym;
388 pst_syms_array[pst_syms_count - 1].end = end_sym;
391 /* Find a suitable symbol table index which can serve as the upper
392 bound of a psymtab that starts at INDEX
394 This scans backwards in the psymtab symbol index table to find a
395 "hole" in which the given index can fit. This is a heuristic!!
396 We don't search the entire table to check for multiple holes,
397 we don't care about overlaps, etc.
399 Return 0 => not found */
401 find_next_pst_start (index)
406 for (i = pst_syms_count - 1; i >= 0; i--)
407 if (pst_syms_array[i].end <= index)
408 return (i == pst_syms_count - 1) ? 0 : pst_syms_array[i + 1].start - 1;
410 if (pst_syms_array[0].start > index)
411 return pst_syms_array[0].start - 1;
418 /* Utility functions to find the ending symbol index for a psymtab */
420 /* Find the next file entry that begins beyond INDEX, and return
421 its starting symbol index - 1.
422 QFD is the file table, CURR_FD is the file entry from where to start,
423 PXDB_HEADER_P as in hpread_quick_traverse (to allow macros to work).
425 Return 0 => not found */
427 find_next_file_isym (index, qFD, curr_fd, pxdb_header_p)
429 quick_file_entry *qFD;
431 PXDB_header_ptr pxdb_header_p;
433 while (VALID_CURR_FILE)
435 if (CURR_FILE_ISYM >= index)
436 return CURR_FILE_ISYM - 1;
442 /* Find the next procedure entry that begins beyond INDEX, and return
443 its starting symbol index - 1.
444 QPD is the procedure table, CURR_PD is the proc entry from where to start,
445 PXDB_HEADER_P as in hpread_quick_traverse (to allow macros to work).
447 Return 0 => not found */
449 find_next_proc_isym (index, qPD, curr_pd, pxdb_header_p)
451 quick_procedure_entry *qPD;
453 PXDB_header_ptr pxdb_header_p;
455 while (VALID_CURR_PROC)
457 if (CURR_PROC_ISYM >= index)
458 return CURR_PROC_ISYM - 1;
464 /* Find the next module entry that begins beyond INDEX, and return
465 its starting symbol index - 1.
466 QMD is the module table, CURR_MD is the modue entry from where to start,
467 PXDB_HEADER_P as in hpread_quick_traverse (to allow macros to work).
469 Return 0 => not found */
471 find_next_module_isym (index, qMD, curr_md, pxdb_header_p)
473 quick_module_entry *qMD;
475 PXDB_header_ptr pxdb_header_p;
477 while (VALID_CURR_MODULE)
479 if (CURR_MODULE_ISYM >= index)
480 return CURR_MODULE_ISYM - 1;
486 /* Scan and record partial symbols for all functions starting from index
487 pointed to by CURR_PD_P, and between code addresses START_ADR and END_ADR.
488 Other parameters are explained in comments below. */
490 /* This used to be inline in hpread_quick_traverse, but now that we do essentially the
491 same thing for two different cases (modules and module-less files), it's better
492 organized in a separate routine, although it does take lots of arguments. pai/1997-10-08 */
495 scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile, section_offsets)
496 int *curr_pd_p; /* pointer to current proc index */
497 quick_procedure_entry *qPD; /* the procedure quick lookup table */
498 int max_procs; /* number of entries in proc. table */
499 CORE_ADDR start_adr; /* beginning of code range for current psymtab */
500 CORE_ADDR end_adr; /* end of code range for current psymtab */
501 struct partial_symtab *pst; /* current psymtab */
502 char *vt_bits; /* strings table of SOM debug space */
503 struct objfile *objfile; /* current object file */
504 struct section_offsets *section_offsets; /* not really used for HP-UX currently */
506 union dnttentry *dn_bufp;
507 int symbol_count = 0; /* Total number of symbols in this psymtab */
508 int curr_pd = *curr_pd_p; /* Convenience variable -- avoid dereferencing pointer all the time */
511 /* Turn this on for lots of debugging information in this routine */
512 static int dumping = 0;
518 printf ("Scan_procs called, addresses %x to %x, proc %x\n", start_adr, end_adr, curr_pd);
522 while ((CURR_PROC_START <= end_adr) && (curr_pd < max_procs))
525 char *rtn_name; /* mangled name */
526 char *rtn_dem_name; /* qualified demangled name */
530 if ((trans_lang ((enum hp_language) qPD[curr_pd].language) == language_cplus) &&
531 vt_bits[(long) qPD[curr_pd].sbAlias]) /* not a null string */
533 /* Get mangled name for the procedure, and demangle it */
534 rtn_name = &vt_bits[(long) qPD[curr_pd].sbAlias];
535 rtn_dem_name = cplus_demangle (rtn_name, DMGL_ANSI | DMGL_PARAMS);
539 rtn_name = &vt_bits[(long) qPD[curr_pd].sbProc];
543 /* Hack to get around HP C/C++ compilers' insistence on providing
544 "_MAIN_" as an alternate name for "main" */
545 if ((strcmp (rtn_name, "_MAIN_") == 0) &&
546 (strcmp (&vt_bits[(long) qPD[curr_pd].sbProc], "main") == 0))
547 rtn_dem_name = rtn_name = main_string;
552 printf ("..add %s (demangled %s), index %x to this psymtab\n", rtn_name, rtn_dem_name, curr_pd);
556 /* Check for module-spanning routines. */
557 if (CURR_PROC_END > end_adr)
560 warning ("Procedure \"%s\" [0x%x] spans file or module boundaries.", rtn_name, curr_pd);
563 /* I asked for this in the hope it would fix bug CHFts22228, but
564 later decided it's not the right fix. I'm leaving the code
565 commented out for now in case we decide we actually want to do this.
568 /* Check this routine--if it's a class member function,
569 add the class to the psymtab. We only need to add
570 the class once in each module, so check. */
571 if (qPD[curr_pd].member)
574 class = qPD[curr_pd].icd;
575 if (!B_TST (class_entered, class))
576 { /* pai: (temp) class_entered not a parameter */
578 class_name = &vt_bits[(long) qCD[class].sbClass];
580 /* Add to both the struct and var namespace */
582 add_psymbol_to_list (class_name,
585 LOC_UNDEF, /* "I have no storage" */
586 &objfile->global_psymbols, /* assume classname is global */
588 trans_lang ((enum hp_language) qPD[curr_pd].language),
591 add_psymbol_to_list (class_name,
594 LOC_UNDEF, /* "I have no storage" */
595 &objfile->global_psymbols, /* assume classname is global */
597 trans_lang ((enum hp_language) qPD[curr_pd].language),
600 B_SET (class_entered, class); /* pai: (temp) class_entered not a parameter */
606 /* Add this routine symbol to the list in the objfile.
607 Unfortunately we have to go to the LNTT to determine the
608 correct list to put it on. An alternative (which the
609 code used to do) would be to not check and always throw
610 it on the "static" list. But if we go that route, then
611 symbol_lookup() needs to be tweaked a bit to account
612 for the fact that the function might not be found on
613 the correct list in the psymtab. - RT */
614 dn_bufp = hpread_get_lntt (qPD[curr_pd].isym, objfile);
615 if (dn_bufp->dfunc.global)
616 add_psymbol_with_dem_name_to_list (rtn_name,
619 strlen (rtn_dem_name),
621 LOC_BLOCK, /* "I am a routine" */
622 &objfile->global_psymbols,
623 (qPD[curr_pd].adrStart + /* Starting address of rtn */
624 ANOFFSET (section_offsets, SECT_OFF_TEXT)),
626 trans_lang ((enum hp_language) qPD[curr_pd].language),
629 add_psymbol_with_dem_name_to_list (rtn_name,
632 strlen (rtn_dem_name),
634 LOC_BLOCK, /* "I am a routine" */
635 &objfile->static_psymbols,
636 (qPD[curr_pd].adrStart + /* Starting address of rtn */
637 ANOFFSET (section_offsets, SECT_OFF_TEXT)),
639 trans_lang ((enum hp_language) qPD[curr_pd].language),
643 *curr_pd_p = ++curr_pd; /* bump up count & reflect in caller */
644 } /* loop over procedures */
649 if (symbol_count == 0)
650 printf ("Scan_procs: no symbols found!\n");
658 /* Traverse the quick look-up tables, building a set of psymtabs.
660 This constructs a psymtab for modules and files in the quick lookup
663 Mostly, modules correspond to compilation units, so we try to
664 create psymtabs that correspond to modules; however, in some cases
665 a file can result in a compiled object which does not have a module
666 entry for it, so in such cases we create a psymtab for the file. */
669 hpread_quick_traverse (objfile, section_offsets, gntt_bits, vt_bits, pxdb_header_p)
670 struct objfile *objfile; /* The object file descriptor */
671 struct section_offsets *section_offsets; /* ?? Null for HP */
672 char *gntt_bits; /* GNTT entries, loaded in from the file */
673 char *vt_bits; /* VT (string) entries ditto. */
674 PXDB_header_ptr pxdb_header_p; /* Pointer to pxdb header ditto */
676 struct partial_symtab *pst;
680 quick_procedure_entry *qPD;
681 quick_file_entry *qFD;
682 quick_module_entry *qMD;
683 quick_class_entry *qCD;
687 CORE_ADDR start_adr; /* current psymtab's starting code addr */
688 CORE_ADDR end_adr; /* current psymtab's ending code addr */
689 CORE_ADDR next_mod_adr; /* next module's starting code addr */
690 int curr_pd; /* current procedure */
691 int curr_fd; /* current file */
692 int curr_md; /* current module */
693 int start_sym; /* current psymtab's starting symbol index */
694 int end_sym; /* current psymtab's ending symbol index */
695 int max_LNTT_sym_index;
697 B_TYPE *class_entered;
699 struct partial_symbol **global_syms; /* We'll be filling in the "global" */
700 struct partial_symbol **static_syms; /* and "static" tables in the objfile
701 as we go, so we need a pair of
705 /* Turn this on for lots of debugging information in this routine.
706 You get a blow-by-blow account of quick lookup table reading */
707 static int dumping = 0;
710 pst = (struct partial_symtab *) 0;
712 /* Clear out some globals */
716 /* Demangling style -- if EDG style already set, don't change it,
717 as HP style causes some problems with the KAI EDG compiler */
718 if (current_demangling_style != edg_demangling)
720 /* Otherwise, ensure that we are using HP style demangling */
721 set_demangling_style (HP_DEMANGLING_STYLE_STRING);
724 /* First we need to find the starting points of the quick
725 look-up tables in the GNTT. */
729 qPD = (quick_procedure_entry_ptr) addr;
730 addr += pxdb_header_p->pd_entries * sizeof (quick_procedure_entry);
735 printf ("\n Printing routines as we see them\n");
736 for (i = 0; VALID_PROC (i); i++)
738 idx = (long) qPD[i].sbProc;
739 printf ("%s %x..%x\n", &vt_bits[idx],
740 (int) PROC_START (i),
746 qFD = (quick_file_entry_ptr) addr;
747 addr += pxdb_header_p->fd_entries * sizeof (quick_file_entry);
752 printf ("\n Printing files as we see them\n");
753 for (i = 0; VALID_FILE (i); i++)
755 idx = (long) qFD[i].sbFile;
756 printf ("%s %x..%x\n", &vt_bits[idx],
757 (int) FILE_START (i),
763 qMD = (quick_module_entry_ptr) addr;
764 addr += pxdb_header_p->md_entries * sizeof (quick_module_entry);
769 printf ("\n Printing modules as we see them\n");
770 for (i = 0; i < pxdb_header_p->md_entries; i++)
772 idx = (long) qMD[i].sbMod;
773 printf ("%s\n", &vt_bits[idx]);
778 qCD = (quick_class_entry_ptr) addr;
779 addr += pxdb_header_p->cd_entries * sizeof (quick_class_entry);
784 printf ("\n Printing classes as we see them\n");
785 for (i = 0; VALID_CLASS (i); i++)
787 idx = (long) qCD[i].sbClass;
788 printf ("%s\n", &vt_bits[idx]);
791 printf ("\n Done with dump, on to build!\n");
795 /* We need this index only while hp-symtab-read.c expects
796 a byte offset to the end of the LNTT entries for a given
797 psymtab. Thus the need for it should go away someday.
799 When it goes away, then we won't have any need to load the
800 LNTT from the objfile at psymtab-time, and start-up will be
801 faster. To make that work, we'll need some way to create
802 a null pst for the "globals" pseudo-module. */
803 max_LNTT_sym_index = LNTT_SYMCOUNT (objfile);
805 /* Scan the module descriptors and make a psymtab for each.
807 We know the MDs, FDs and the PDs are in order by starting
808 address. We use that fact to traverse all three arrays in
809 parallel, knowing when the next PD is in a new file
810 and we need to create a new psymtab. */
811 curr_pd = 0; /* Current procedure entry */
812 curr_fd = 0; /* Current file entry */
813 curr_md = 0; /* Current module entry */
815 start_adr = 0; /* Current psymtab code range */
818 start_sym = 0; /* Current psymtab symbol range */
821 syms_in_pst = 0; /* Symbol count for psymtab */
823 /* Psts actually just have pointers into the objfile's
824 symbol table, not their own symbol tables. */
825 global_syms = objfile->global_psymbols.list;
826 static_syms = objfile->static_psymbols.list;
828 #if 0 /* pai: (temp) we don't need this any more */
829 /* elz: if the first module we see in the table is for
830 end.c, then return immediately with false. This happens
831 for F77 programs, for which there is no MODULE information
832 produced in the debug info.
833 Returning false from this function will make the caller
834 (build_psymbols) scan the table from the beginning and
835 not use the quick lookup tables.
836 F90 has modules so this poses no problem. */
837 if (!strcmp (&vt_bits[(long) qMD[0].sbMod], "end.c"))
841 /* First skip over pseudo-entries with address 0. These represent inlined
842 routines and abstract (uninstantiated) template routines.
843 FIXME: These should be read in and available -- even if we can't set
844 breakpoints, etc., there's some information that can be presented
845 to the user. pai/1997-10-08 */
847 while (VALID_CURR_PROC && (CURR_PROC_START == 0))
850 /* Loop over files, modules, and procedures in code address order. Each
851 time we enter an iteration of this loop, curr_pd points to the first
852 unprocessed procedure, curr_fd points to the first unprocessed file, and
853 curr_md to the first unprocessed module. Each iteration of this loop
854 updates these as required -- any or all of them may be bumpd up
855 each time around. When we exit this loop, we are done with all files
856 and modules in the tables -- there may still be some procedures, however.
858 Note: This code used to loop only over module entries, under the assumption
859 that files can occur via inclusions and are thus unreliable, while a
860 compiled object always corresponds to a module. With CTTI in the HP aCC
861 compiler, it turns out that compiled objects may have only files and no
862 modules; so we have to loop over files and modules, creating psymtabs for
863 either as appropriate. Unfortunately there are some problems (notably:
864 1. the lack of "SRC_FILE_END" entries in the LNTT, 2. the lack of pointers
865 to the ending symbol indices of a module or a file) which make it quite hard
866 to do this correctly. Currently it uses a bunch of heuristics to start and
867 end psymtabs; they seem to work well with most objects generated by aCC, but
868 who knows when that will change... */
870 while (VALID_CURR_FILE || VALID_CURR_MODULE)
873 char *mod_name_string;
874 char *full_name_string;
876 /* First check for modules like "version.c", which have no code
877 in them but still have qMD entries. They also have no qFD or
878 qPD entries. Their start address is -1 and their end address
880 if (VALID_CURR_MODULE && (CURR_MODULE_START == -1) && (CURR_MODULE_END == NULL))
883 mod_name_string = &vt_bits[(long) qMD[curr_md].sbMod];
887 printf ("Module with data only %s\n", mod_name_string);
890 /* We'll skip the rest (it makes error-checking easier), and
891 just make an empty pst. Right now empty psts are not put
892 in the pst chain, so all this is for naught, but later it
895 pst = hpread_start_psymtab (objfile,
896 section_offsets, /* ?? */
898 CURR_MODULE_START, /* Low text address: bogus! */
899 (CURR_MODULE_ISYM * sizeof (struct dntt_type_block)),
904 pst = hpread_end_psymtab (pst,
905 NULL, /* psymtab_include_list */
906 0, /* includes_used */
907 end_sym * sizeof (struct dntt_type_block),
908 /* byte index in LNTT of end
909 = capping symbol offset
910 = LDSYMOFF of nextfile */
911 NULL, /* text high */
912 NULL, /* dependency_list */
913 0); /* dependencies_used */
915 global_syms = objfile->global_psymbols.next;
916 static_syms = objfile->static_psymbols.next;
920 else if (VALID_CURR_MODULE &&
921 ((CURR_MODULE_START == 0) || (CURR_MODULE_START == -1) ||
922 (CURR_MODULE_END == 0) || (CURR_MODULE_END == -1)))
925 warning ("Module \"%s\" [0x%x] has non-standard addresses. It starts at 0x%x, ends at 0x%x, and will be skipped.",
926 mod_name_string, curr_md, start_adr, end_adr);
927 /* On to next module */
932 /* First check if we are looking at a file with code in it
933 that does not overlap the current module's code range */
935 if (VALID_CURR_FILE ? (VALID_CURR_MODULE ? (CURR_FILE_END < CURR_MODULE_START) : 1) : 0)
938 /* Looking at file not corresponding to any module,
939 create a psymtab for it */
940 full_name_string = &vt_bits[(long) qFD[curr_fd].sbFile];
941 start_adr = CURR_FILE_START;
942 end_adr = CURR_FILE_END;
943 start_sym = CURR_FILE_ISYM;
945 /* Check if there are any procedures not handled until now, that
946 begin before the start address of this file, and if so, adjust
947 this module's start address to include them. This handles routines that
948 are in between file or module ranges for some reason (probably
949 indicates a compiler bug */
951 if (CURR_PROC_START < start_adr)
954 warning ("Found procedure \"%s\" [0x%x] that is not in any file or module.",
955 &vt_bits[(long) qPD[curr_pd].sbProc], curr_pd);
956 start_adr = CURR_PROC_START;
957 if (CURR_PROC_ISYM < start_sym)
958 start_sym = CURR_PROC_ISYM;
961 /* Sometimes (compiler bug -- COBOL) the module end address is higher
962 than the start address of the next module, so check for that and
963 adjust accordingly */
965 if (VALID_FILE (curr_fd + 1) && (FILE_START (curr_fd + 1) <= end_adr))
968 warning ("File \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down.",
969 full_name_string, curr_fd);
970 end_adr = FILE_START (curr_fd + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
972 if (VALID_MODULE (curr_md) && (CURR_MODULE_START <= end_adr))
975 warning ("File \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down.",
976 full_name_string, curr_fd);
977 end_adr = CURR_MODULE_START - 1; /* Is -4 (or -8 for 64-bit) better? */
984 printf ("Make new psymtab for file %s (%x to %x).\n",
985 full_name_string, start_adr, end_adr);
988 /* Create the basic psymtab, connecting it in the list
989 for this objfile and pointing its symbol entries
990 to the current end of the symbol areas in the objfile.
992 The "ldsymoff" parameter is the byte offset in the LNTT
993 of the first symbol in this file. Some day we should
994 turn this into an index (fix in hp-symtab-read.c as well).
995 And it's not even the right byte offset, as we're using
996 the size of a union! FIXME! */
997 pst = hpread_start_psymtab (objfile,
998 section_offsets, /* ?? */
1000 start_adr, /* Low text address */
1001 (start_sym * sizeof (struct dntt_type_block)),
1006 /* Set up to only enter each class referenced in this module once. */
1007 class_entered = malloc (B_BYTES (pxdb_header_p->cd_entries));
1008 B_CLRALL (class_entered, pxdb_header_p->cd_entries);
1010 /* Scan the procedure descriptors for procedures in the current
1011 file, based on the starting addresses. */
1013 syms_in_pst = scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
1015 pst, vt_bits, objfile, section_offsets);
1017 /* Get ending symbol offset */
1020 /* First check for starting index before previous psymtab */
1021 if (pst_syms_count && start_sym < pst_syms_array[pst_syms_count - 1].end)
1023 end_sym = find_next_pst_start (start_sym);
1025 /* Look for next start index of a file or module, or procedure */
1028 int next_file_isym = find_next_file_isym (start_sym, qFD, curr_fd + 1, pxdb_header_p);
1029 int next_module_isym = find_next_module_isym (start_sym, qMD, curr_md, pxdb_header_p);
1030 int next_proc_isym = find_next_proc_isym (start_sym, qPD, curr_pd, pxdb_header_p);
1032 if (next_file_isym && next_module_isym)
1034 /* pick lower of next file or module start index */
1035 end_sym = min (next_file_isym, next_module_isym);
1039 /* one of them is zero, pick the other */
1040 end_sym = max (next_file_isym, next_module_isym);
1043 /* As a precaution, check next procedure index too */
1045 end_sym = next_proc_isym;
1047 end_sym = min (end_sym, next_proc_isym);
1050 /* Couldn't find procedure, file, or module, use globals as default */
1052 end_sym = pxdb_header_p->globals;
1057 printf ("File psymtab indices: %x to %x\n", start_sym, end_sym);
1061 pst = hpread_end_psymtab (pst,
1062 NULL, /* psymtab_include_list */
1063 0, /* includes_used */
1064 end_sym * sizeof (struct dntt_type_block),
1065 /* byte index in LNTT of end
1066 = capping symbol offset
1067 = LDSYMOFF of nextfile */
1068 end_adr, /* text high */
1069 NULL, /* dependency_list */
1070 0); /* dependencies_used */
1072 record_pst_syms (start_sym, end_sym);
1075 warning ("No symbols in psymtab for file \"%s\" [0x%x].", full_name_string, curr_fd);
1080 printf ("Made new psymtab for file %s (%x to %x), sym %x to %x.\n",
1081 full_name_string, start_adr, end_adr, CURR_FILE_ISYM, end_sym);
1084 /* Prepare for the next psymtab. */
1085 global_syms = objfile->global_psymbols.next;
1086 static_syms = objfile->static_psymbols.next;
1087 free (class_entered);
1090 } /* Psymtab for file */
1093 /* We have a module for which we create a psymtab */
1095 mod_name_string = &vt_bits[(long) qMD[curr_md].sbMod];
1097 /* We will include the code ranges of any files that happen to
1098 overlap with this module */
1100 /* So, first pick the lower of the file's and module's start addresses */
1101 start_adr = CURR_MODULE_START;
1102 if (VALID_CURR_FILE)
1104 if (CURR_FILE_START < CURR_MODULE_START)
1107 warning ("File \"%s\" [0x%x] crosses beginning of module \"%s\".",
1108 &vt_bits[(long) qFD[curr_fd].sbFile],
1109 curr_fd, mod_name_string);
1111 start_adr = CURR_FILE_START;
1115 /* Also pick the lower of the file's and the module's start symbol indices */
1116 start_sym = CURR_MODULE_ISYM;
1117 if (VALID_CURR_FILE && (CURR_FILE_ISYM < CURR_MODULE_ISYM))
1118 start_sym = CURR_FILE_ISYM;
1120 /* For the end address, we scan through the files till we find one
1121 that overlaps the current module but ends beyond it; if no such file exists we
1122 simply use the module's start address.
1123 (Note, if file entries themselves overlap
1124 we take the longest overlapping extension beyond the end of the module...)
1125 We assume that modules never overlap. */
1127 end_adr = CURR_MODULE_END;
1129 if (VALID_CURR_FILE)
1131 while (VALID_CURR_FILE && (CURR_FILE_START < end_adr))
1136 printf ("Maybe skipping file %s which overlaps with module %s\n",
1137 &vt_bits[(long) qFD[curr_fd].sbFile], mod_name_string);
1139 if (CURR_FILE_END > end_adr)
1142 warning ("File \"%s\" [0x%x] crosses end of module \"%s\".",
1143 &vt_bits[(long) qFD[curr_fd].sbFile],
1144 curr_fd, mod_name_string);
1145 end_adr = CURR_FILE_END;
1149 curr_fd--; /* back up after going too far */
1152 /* Sometimes (compiler bug -- COBOL) the module end address is higher
1153 than the start address of the next module, so check for that and
1154 adjust accordingly */
1156 if (VALID_MODULE (curr_md + 1) && (MODULE_START (curr_md + 1) <= end_adr))
1159 warning ("Module \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down.",
1160 mod_name_string, curr_md);
1161 end_adr = MODULE_START (curr_md + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
1163 if (VALID_FILE (curr_fd + 1) && (FILE_START (curr_fd + 1) <= end_adr))
1166 warning ("Module \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down.",
1167 mod_name_string, curr_md);
1168 end_adr = FILE_START (curr_fd + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
1171 /* Use one file to get the full name for the module. This
1172 situation can arise if there is executable code in a #include
1173 file. Each file with code in it gets a qFD. Files which don't
1174 contribute code don't get a qFD, even if they include files
1179 #include "rtn.h" return x;
1182 There will a qFD for "rtn.h",and a qMD for "body.c",
1183 but no qMD for "rtn.h" or qFD for "body.c"!
1185 We pick the name of the last file to overlap with this
1186 module. C convention is to put include files first. In a
1187 perfect world, we could check names and use the file whose full
1188 path name ends with the module name. */
1190 if (VALID_CURR_FILE)
1191 full_name_string = &vt_bits[(long) qFD[curr_fd].sbFile];
1193 full_name_string = mod_name_string;
1195 /* Check if there are any procedures not handled until now, that
1196 begin before the start address we have now, and if so, adjust
1197 this psymtab's start address to include them. This handles routines that
1198 are in between file or module ranges for some reason (probably
1199 indicates a compiler bug */
1201 if (CURR_PROC_START < start_adr)
1204 warning ("Found procedure \"%s\" [0x%x] that is not in any file or module.",
1205 &vt_bits[(long) qPD[curr_pd].sbProc], curr_pd);
1206 start_adr = CURR_PROC_START;
1207 if (CURR_PROC_ISYM < start_sym)
1208 start_sym = CURR_PROC_ISYM;
1214 printf ("Make new psymtab for module %s (%x to %x), using file %s\n",
1215 mod_name_string, start_adr, end_adr, full_name_string);
1218 /* Create the basic psymtab, connecting it in the list
1219 for this objfile and pointing its symbol entries
1220 to the current end of the symbol areas in the objfile.
1222 The "ldsymoff" parameter is the byte offset in the LNTT
1223 of the first symbol in this file. Some day we should
1224 turn this into an index (fix in hp-symtab-read.c as well).
1225 And it's not even the right byte offset, as we're using
1226 the size of a union! FIXME! */
1227 pst = hpread_start_psymtab (objfile,
1228 section_offsets, /* ?? */
1230 start_adr, /* Low text address */
1231 (start_sym * sizeof (struct dntt_type_block)),
1236 /* Set up to only enter each class referenced in this module once. */
1237 class_entered = malloc (B_BYTES (pxdb_header_p->cd_entries));
1238 B_CLRALL (class_entered, pxdb_header_p->cd_entries);
1240 /* Scan the procedure descriptors for procedures in the current
1241 module, based on the starting addresses. */
1243 syms_in_pst = scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
1245 pst, vt_bits, objfile, section_offsets);
1247 /* Get ending symbol offset */
1250 /* First check for starting index before previous psymtab */
1251 if (pst_syms_count && start_sym < pst_syms_array[pst_syms_count - 1].end)
1253 end_sym = find_next_pst_start (start_sym);
1255 /* Look for next start index of a file or module, or procedure */
1258 int next_file_isym = find_next_file_isym (start_sym, qFD, curr_fd + 1, pxdb_header_p);
1259 int next_module_isym = find_next_module_isym (start_sym, qMD, curr_md + 1, pxdb_header_p);
1260 int next_proc_isym = find_next_proc_isym (start_sym, qPD, curr_pd, pxdb_header_p);
1262 if (next_file_isym && next_module_isym)
1264 /* pick lower of next file or module start index */
1265 end_sym = min (next_file_isym, next_module_isym);
1269 /* one of them is zero, pick the other */
1270 end_sym = max (next_file_isym, next_module_isym);
1273 /* As a precaution, check next procedure index too */
1275 end_sym = next_proc_isym;
1277 end_sym = min (end_sym, next_proc_isym);
1280 /* Couldn't find procedure, file, or module, use globals as default */
1282 end_sym = pxdb_header_p->globals;
1287 printf ("Module psymtab indices: %x to %x\n", start_sym, end_sym);
1291 pst = hpread_end_psymtab (pst,
1292 NULL, /* psymtab_include_list */
1293 0, /* includes_used */
1294 end_sym * sizeof (struct dntt_type_block),
1295 /* byte index in LNTT of end
1296 = capping symbol offset
1297 = LDSYMOFF of nextfile */
1298 end_adr, /* text high */
1299 NULL, /* dependency_list */
1300 0); /* dependencies_used */
1302 record_pst_syms (start_sym, end_sym);
1305 warning ("No symbols in psymtab for module \"%s\" [0x%x].", mod_name_string, curr_md);
1310 printf ("Made new psymtab for module %s (%x to %x), sym %x to %x.\n",
1311 mod_name_string, start_adr, end_adr, CURR_MODULE_ISYM, end_sym);
1315 /* Prepare for the next psymtab. */
1316 global_syms = objfile->global_psymbols.next;
1317 static_syms = objfile->static_psymbols.next;
1318 free (class_entered);
1322 } /* psymtab for module */
1323 } /* psymtab for non-bogus file or module */
1324 } /* End of while loop over all files & modules */
1326 /* There may be some routines after all files and modules -- these will get
1327 inserted in a separate new module of their own */
1328 if (VALID_CURR_PROC)
1330 start_adr = CURR_PROC_START;
1331 end_adr = qPD[pxdb_header_p->pd_entries - 1].adrEnd;
1333 warning ("Found functions beyond end of all files and modules [0x%x].", curr_pd);
1337 printf ("Orphan functions at end, PD %d and beyond (%x to %x)\n",
1338 curr_pd, start_adr, end_adr);
1341 pst = hpread_start_psymtab (objfile,
1342 section_offsets, /* ?? */
1344 start_adr, /* Low text address */
1345 (CURR_PROC_ISYM * sizeof (struct dntt_type_block)),
1350 scan_procs (&curr_pd, qPD, pxdb_header_p->pd_entries,
1352 pst, vt_bits, objfile, section_offsets);
1354 pst = hpread_end_psymtab (pst,
1355 NULL, /* psymtab_include_list */
1356 0, /* includes_used */
1357 pxdb_header_p->globals * sizeof (struct dntt_type_block),
1358 /* byte index in LNTT of end
1359 = capping symbol offset
1360 = LDSYMOFF of nextfile */
1361 end_adr, /* text high */
1362 NULL, /* dependency_list */
1363 0); /* dependencies_used */
1368 /* Now build psts for non-module things (in the tail of
1369 the LNTT, after the last END MODULE entry).
1371 If null psts were kept on the chain, this would be
1372 a solution. FIXME */
1373 pst = hpread_start_psymtab (objfile,
1377 (pxdb_header_p->globals
1378 * sizeof (struct dntt_type_block)),
1379 objfile->global_psymbols.next,
1380 objfile->static_psymbols.next);
1381 hpread_end_psymtab (pst,
1383 (max_LNTT_sym_index * sizeof (struct dntt_type_block)),
1392 } /* End of hpread_quick_traverse. */
1395 /* Get appropriate header, based on pxdb type.
1396 Return value: 1 if ok, 0 if not */
1398 hpread_get_header (objfile, pxdb_header_p)
1399 struct objfile *objfile;
1400 PXDB_header_ptr pxdb_header_p;
1402 asection *pinfo_section, *debug_section, *header_section;
1405 /* Turn on for debugging information */
1406 static int dumping = 0;
1409 header_section = bfd_get_section_by_name (objfile->obfd, "$HEADER$");
1410 if (!header_section)
1412 /* We don't have either PINFO or DEBUG sections. But
1413 stuff like "libc.sl" has no debug info. There's no
1414 need to warn the user of this, as it may be ok. The
1415 caller will figure it out and issue any needed
1419 printf ("==No debug info at all for %s.\n", objfile->name);
1425 /* We would like either a $DEBUG$ or $PINFO$ section.
1426 Once we know which, we can understand the header
1427 data (which we have defined to suit the more common
1429 debug_section = bfd_get_section_by_name (objfile->obfd, "$DEBUG$");
1430 pinfo_section = bfd_get_section_by_name (objfile->obfd, "$PINFO$");
1433 /* The expected case: normal pxdb header. */
1434 bfd_get_section_contents (objfile->obfd, header_section,
1435 pxdb_header_p, 0, sizeof (PXDB_header));
1437 if (!pxdb_header_p->pxdbed)
1439 /* This shouldn't happen if we check in "symfile.c". */
1441 } /* DEBUG section */
1444 else if (pinfo_section)
1446 /* The DOC case; we need to translate this into a
1448 DOC_info_PXDB_header doc_header;
1453 printf ("==OOps, PINFO, let's try to handle this, %s.\n", objfile->name);
1457 bfd_get_section_contents (objfile->obfd,
1460 sizeof (DOC_info_PXDB_header));
1462 if (!doc_header.pxdbed)
1464 /* This shouldn't happen if we check in "symfile.c". */
1465 warning ("File \"%s\" not processed by pxdb!", objfile->name);
1469 /* Copy relevent fields to standard header passed in. */
1470 pxdb_header_p->pd_entries = doc_header.pd_entries;
1471 pxdb_header_p->fd_entries = doc_header.fd_entries;
1472 pxdb_header_p->md_entries = doc_header.md_entries;
1473 pxdb_header_p->pxdbed = doc_header.pxdbed;
1474 pxdb_header_p->bighdr = doc_header.bighdr;
1475 pxdb_header_p->sa_header = doc_header.sa_header;
1476 pxdb_header_p->inlined = doc_header.inlined;
1477 pxdb_header_p->globals = doc_header.globals;
1478 pxdb_header_p->time = doc_header.time;
1479 pxdb_header_p->pg_entries = doc_header.pg_entries;
1480 pxdb_header_p->functions = doc_header.functions;
1481 pxdb_header_p->files = doc_header.files;
1482 pxdb_header_p->cd_entries = doc_header.cd_entries;
1483 pxdb_header_p->aa_entries = doc_header.aa_entries;
1484 pxdb_header_p->oi_entries = doc_header.oi_entries;
1485 pxdb_header_p->version = doc_header.version;
1486 } /* PINFO section */
1492 printf ("==No debug info at all for %s.\n", objfile->name);
1500 } /* End of hpread_get_header */
1501 #endif /* QUICK_LOOK_UP */
1504 /* Initialization for reading native HP C debug symbols from OBJFILE.
1506 Its only purpose in life is to set up the symbol reader's private
1507 per-objfile data structures, and read in the raw contents of the debug
1508 sections (attaching pointers to the debug info into the private data
1511 Since BFD doesn't know how to read debug symbols in a format-independent
1512 way (and may never do so...), we have to do it ourselves. Note we may
1513 be called on a file without native HP C debugging symbols.
1515 FIXME, there should be a cleaner peephole into the BFD environment
1518 hpread_symfile_init (objfile)
1519 struct objfile *objfile;
1521 asection *vt_section, *slt_section, *lntt_section, *gntt_section;
1523 /* Allocate struct to keep track of the symfile */
1524 objfile->sym_private = (PTR)
1525 xmmalloc (objfile->md, sizeof (struct hpread_symfile_info));
1526 memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
1528 /* We haven't read in any types yet. */
1529 TYPE_VECTOR (objfile) = 0;
1531 /* Read in data from the $GNTT$ subspace. */
1532 gntt_section = bfd_get_section_by_name (objfile->obfd, "$GNTT$");
1537 = obstack_alloc (&objfile->symbol_obstack,
1538 bfd_section_size (objfile->obfd, gntt_section));
1540 bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile),
1541 0, bfd_section_size (objfile->obfd, gntt_section));
1543 GNTT_SYMCOUNT (objfile)
1544 = bfd_section_size (objfile->obfd, gntt_section)
1545 / sizeof (struct dntt_type_block);
1547 /* Read in data from the $LNTT$ subspace. Also keep track of the number
1550 FIXME: this could be moved into the psymtab-to-symtab expansion
1551 code, and save startup time. At the moment this data is
1552 still used, though. We'd need a way to tell hp-symtab-read.c
1553 whether or not to load the LNTT. */
1554 lntt_section = bfd_get_section_by_name (objfile->obfd, "$LNTT$");
1559 = obstack_alloc (&objfile->symbol_obstack,
1560 bfd_section_size (objfile->obfd, lntt_section));
1562 bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile),
1563 0, bfd_section_size (objfile->obfd, lntt_section));
1565 LNTT_SYMCOUNT (objfile)
1566 = bfd_section_size (objfile->obfd, lntt_section)
1567 / sizeof (struct dntt_type_block);
1569 /* Read in data from the $SLT$ subspace. $SLT$ contains information
1570 on source line numbers. */
1571 slt_section = bfd_get_section_by_name (objfile->obfd, "$SLT$");
1576 obstack_alloc (&objfile->symbol_obstack,
1577 bfd_section_size (objfile->obfd, slt_section));
1579 bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile),
1580 0, bfd_section_size (objfile->obfd, slt_section));
1582 /* Read in data from the $VT$ subspace. $VT$ contains things like
1583 names and constants. Keep track of the number of symbols in the VT. */
1584 vt_section = bfd_get_section_by_name (objfile->obfd, "$VT$");
1588 VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section);
1591 (char *) obstack_alloc (&objfile->symbol_obstack,
1594 bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile),
1595 0, VT_SIZE (objfile));
1598 /* Scan and build partial symbols for a symbol file.
1600 The minimal symbol table (either SOM or HP a.out) has already been
1601 read in; all we need to do is setup partial symbols based on the
1602 native debugging information.
1604 Note that the minimal table is produced by the linker, and has
1605 only global routines in it; the psymtab is based on compiler-
1606 generated debug information and has non-global
1607 routines in it as well as files and class information.
1609 We assume hpread_symfile_init has been called to initialize the
1610 symbol reader's private data structures.
1612 SECTION_OFFSETS contains offsets relative to which the symbols in the
1613 various sections are (depending where the sections were actually loaded).
1614 MAINLINE is true if we are reading the main symbol table (as
1615 opposed to a shared lib or dynamically loaded file). */
1617 hpread_build_psymtabs (objfile, section_offsets, mainline)
1618 struct objfile *objfile;
1619 struct section_offsets *section_offsets;
1624 /* Turn this on to get debugging output. */
1625 static int dumping = 0;
1629 int past_first_source_file = 0;
1630 struct cleanup *old_chain;
1632 int hp_symnum, symcount, i;
1635 union dnttentry *dn_bufp;
1641 /* Current partial symtab */
1642 struct partial_symtab *pst;
1644 /* List of current psymtab's include files */
1645 char **psymtab_include_list;
1646 int includes_allocated;
1649 /* Index within current psymtab dependency list */
1650 struct partial_symtab **dependency_list;
1651 int dependencies_used, dependencies_allocated;
1653 /* Just in case the stabs reader left turds lying around. */
1654 free_pending_blocks ();
1655 make_cleanup (really_free_pendings, 0);
1657 pst = (struct partial_symtab *) 0;
1659 /* We shouldn't use alloca, instead use malloc/free. Doing so avoids
1660 a number of problems with cross compilation and creating useless holes
1661 in the stack when we have to allocate new entries. FIXME. */
1663 includes_allocated = 30;
1665 psymtab_include_list = (char **) alloca (includes_allocated *
1668 dependencies_allocated = 30;
1669 dependencies_used = 0;
1671 (struct partial_symtab **) alloca (dependencies_allocated *
1672 sizeof (struct partial_symtab *));
1674 old_chain = make_cleanup (free_objfile, objfile);
1676 last_source_file = 0;
1678 #ifdef QUICK_LOOK_UP
1680 /* Begin code for new-style loading of quick look-up tables. */
1682 /* elz: this checks whether the file has beeen processed by pxdb.
1683 If not we would like to try to read the psymbols in
1684 anyway, but it turns out to be not so easy. So this could
1685 actually be commented out, but I leave it in, just in case
1686 we decide to add support for non-pxdb-ed stuff in the future. */
1688 abfd = symfile_bfd_open (objfile->name);
1689 if (!hpread_pxdb_needed (abfd))
1693 PXDB_header pxdb_header;
1694 int found_modules_in_program;
1696 if (hpread_get_header (objfile, &pxdb_header))
1698 /* Build a minimal table. No types, no global variables,
1699 no include files.... */
1702 printf ("\nNew method for %s\n", objfile->name);
1705 /* elz: quick_traverse returns true if it found
1706 some modules in the main source file, other
1708 In C and C++, all the files have MODULES entries
1709 in the LNTT, and the quick table traverse is all
1710 based on finding these MODULES entries. Without
1711 those it cannot work.
1712 It happens that F77 programs don't have MODULES
1713 so the quick traverse gets confused. F90 programs
1714 have modules, and the quick method still works.
1715 So, if modules (other than those in end.c) are
1716 not found we give up on the quick table stuff,
1717 and fall back on the slower method */
1718 found_modules_in_program = hpread_quick_traverse (objfile,
1724 discard_cleanups (old_chain);
1726 /* Set up to scan the global section of the LNTT.
1728 This field is not always correct: if there are
1729 no globals, it will point to the last record in
1730 the regular LNTT, which is usually an END MODULE.
1732 Since it might happen that there could be a file
1733 with just one global record, there's no way to
1734 tell other than by looking at the record, so that's
1736 if (found_modules_in_program)
1737 scan_start = pxdb_header.globals;
1746 printf ("\nGoing on to old method for %s\n", objfile->name);
1750 } /* End of new method code */
1751 } /* end of if pxdb exists */
1752 /* elz: if pxdb does not exists on the system, then scan the whole debug info
1753 Actually this will never be reached because we error out in case there
1754 is no pxdb on the system. It turns out that the debug info cannot be
1755 handled the same way as after bxdb has been run, and gdb gets very
1756 very confused. Ileave this in anyway, in case one day we want to
1757 support non pxdb-ed files. */
1761 bfd_close (abfd); /* close the bfd we opened to check for pxdb */
1763 } /* end of ifdef QUICK_LOOK_UP */
1765 scan_start = 0; /* if we don't want quick lookup tables start
1766 from the beginning */
1769 /* Make two passes, one over the GNTT symbols, the other for the
1772 JB comment: above isn't true--they only make one pass, over
1774 for (i = 0; i < 1; i++)
1776 int within_function = 0;
1779 symcount = GNTT_SYMCOUNT (objfile);
1781 symcount = LNTT_SYMCOUNT (objfile);
1784 for (hp_symnum = scan_start; hp_symnum < symcount; hp_symnum++)
1788 dn_bufp = hpread_get_gntt (hp_symnum, objfile);
1790 dn_bufp = hpread_get_lntt (hp_symnum, objfile);
1792 if (dn_bufp->dblock.extension)
1795 /* Only handle things which are necessary for minimal symbols.
1796 everything else is ignored. */
1797 switch (dn_bufp->dblock.kind)
1799 case DNTT_TYPE_SRCFILE:
1801 #ifdef QUICK_LOOK_UP
1802 if (scan_start == hp_symnum
1803 && symcount == hp_symnum + 1)
1805 /* If there are NO globals in an executable,
1806 PXDB's index to the globals will point to
1807 the last record in the file, which
1808 could be this record. (this happened for F77 libraries)
1809 ignore it and be done! */
1814 /* A source file of some kind. Note this may simply
1815 be an included file. */
1816 SET_NAMESTRING (dn_bufp, &namestring, objfile);
1818 /* Check if this is the source file we are already working
1820 if (pst && !strcmp (namestring, pst->filename))
1823 /* Check if this is an include file, if so check if we have
1824 already seen it. Add it to the include list */
1825 p = strrchr (namestring, '.');
1826 if (!strcmp (p, ".h"))
1831 for (j = 0; j < includes_used; j++)
1832 if (!strcmp (namestring, psymtab_include_list[j]))
1840 /* Add it to the list of includes seen so far and
1841 allocate more include space if necessary. */
1842 psymtab_include_list[includes_used++] = namestring;
1843 if (includes_used >= includes_allocated)
1845 char **orig = psymtab_include_list;
1847 psymtab_include_list = (char **)
1848 alloca ((includes_allocated *= 2) *
1850 memcpy ((PTR) psymtab_include_list, (PTR) orig,
1851 includes_used * sizeof (char *));
1860 pst->filename = (char *)
1861 obstack_alloc (&pst->objfile->psymbol_obstack,
1862 strlen (namestring) + 1);
1863 strcpy (pst->filename, namestring);
1870 /* This is a bonafide new source file.
1871 End the current partial symtab and start a new one. */
1873 if (pst && past_first_source_file)
1875 hpread_end_psymtab (pst, psymtab_include_list,
1878 * sizeof (struct dntt_type_block)),
1880 dependency_list, dependencies_used);
1881 pst = (struct partial_symtab *) 0;
1883 dependencies_used = 0;
1886 past_first_source_file = 1;
1888 valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
1889 valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
1890 pst = hpread_start_psymtab (objfile, section_offsets,
1893 * sizeof (struct dntt_type_block)),
1894 objfile->global_psymbols.next,
1895 objfile->static_psymbols.next);
1901 case DNTT_TYPE_MODULE:
1902 /* A source file. It's still unclear to me what the
1903 real difference between a DNTT_TYPE_SRCFILE and DNTT_TYPE_MODULE
1904 is supposed to be. */
1906 /* First end the previous psymtab */
1909 hpread_end_psymtab (pst, psymtab_include_list, includes_used,
1911 * sizeof (struct dntt_type_block)),
1913 dependency_list, dependencies_used);
1914 pst = (struct partial_symtab *) 0;
1916 dependencies_used = 0;
1920 /* Now begin a new module and a new psymtab for it */
1921 SET_NAMESTRING (dn_bufp, &namestring, objfile);
1922 valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
1923 valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
1926 pst = hpread_start_psymtab (objfile, section_offsets,
1929 * sizeof (struct dntt_type_block)),
1930 objfile->global_psymbols.next,
1931 objfile->static_psymbols.next);
1937 case DNTT_TYPE_FUNCTION:
1938 case DNTT_TYPE_ENTRY:
1939 /* The beginning of a function. DNTT_TYPE_ENTRY may also denote
1940 a secondary entry point. */
1941 valu = dn_bufp->dfunc.hiaddr + ANOFFSET (section_offsets,
1943 if (valu > texthigh)
1945 valu = dn_bufp->dfunc.lowaddr +
1946 ANOFFSET (section_offsets, SECT_OFF_TEXT);
1947 SET_NAMESTRING (dn_bufp, &namestring, objfile);
1948 if (dn_bufp->dfunc.global)
1949 add_psymbol_to_list (namestring, strlen (namestring),
1950 VAR_NAMESPACE, LOC_BLOCK,
1951 &objfile->global_psymbols, valu,
1952 0, language_unknown, objfile);
1954 add_psymbol_to_list (namestring, strlen (namestring),
1955 VAR_NAMESPACE, LOC_BLOCK,
1956 &objfile->static_psymbols, valu,
1957 0, language_unknown, objfile);
1958 within_function = 1;
1961 case DNTT_TYPE_DOC_FUNCTION:
1962 valu = dn_bufp->ddocfunc.hiaddr + ANOFFSET (section_offsets,
1964 if (valu > texthigh)
1966 valu = dn_bufp->ddocfunc.lowaddr +
1967 ANOFFSET (section_offsets, SECT_OFF_TEXT);
1968 SET_NAMESTRING (dn_bufp, &namestring, objfile);
1969 if (dn_bufp->ddocfunc.global)
1970 add_psymbol_to_list (namestring, strlen (namestring),
1971 VAR_NAMESPACE, LOC_BLOCK,
1972 &objfile->global_psymbols, valu,
1973 0, language_unknown, objfile);
1975 add_psymbol_to_list (namestring, strlen (namestring),
1976 VAR_NAMESPACE, LOC_BLOCK,
1977 &objfile->static_psymbols, valu,
1978 0, language_unknown, objfile);
1979 within_function = 1;
1982 case DNTT_TYPE_BEGIN:
1984 /* We don't check MODULE end here, because there can be
1985 symbols beyond the module end which properly belong to the
1986 current psymtab -- so we wait till the next MODULE start */
1989 #ifdef QUICK_LOOK_UP
1990 if (scan_start == hp_symnum
1991 && symcount == hp_symnum + 1)
1993 /* If there are NO globals in an executable,
1994 PXDB's index to the globals will point to
1995 the last record in the file, which is
1996 probably an END MODULE, i.e. this record.
1997 ignore it and be done! */
2001 /* Scope block begin/end. We only care about function
2002 and file blocks right now. */
2004 if ((dn_bufp->dend.endkind == DNTT_TYPE_FUNCTION) ||
2005 (dn_bufp->dend.endkind == DNTT_TYPE_DOC_FUNCTION))
2006 within_function = 0;
2009 case DNTT_TYPE_SVAR:
2010 case DNTT_TYPE_DVAR:
2011 case DNTT_TYPE_TYPEDEF:
2012 case DNTT_TYPE_TAGDEF:
2014 /* Variables, typedefs an the like. */
2015 enum address_class storage;
2016 namespace_enum namespace;
2018 /* Don't add locals to the partial symbol table. */
2020 && (dn_bufp->dblock.kind == DNTT_TYPE_SVAR
2021 || dn_bufp->dblock.kind == DNTT_TYPE_DVAR))
2024 /* TAGDEFs go into the structure namespace. */
2025 if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF)
2026 namespace = STRUCT_NAMESPACE;
2028 namespace = VAR_NAMESPACE;
2030 /* What kind of "storage" does this use? */
2031 if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR)
2032 storage = LOC_STATIC;
2033 else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR
2034 && dn_bufp->ddvar.regvar)
2035 storage = LOC_REGISTER;
2036 else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR)
2037 storage = LOC_LOCAL;
2039 storage = LOC_UNDEF;
2041 SET_NAMESTRING (dn_bufp, &namestring, objfile);
2044 pst = hpread_start_psymtab (objfile, section_offsets,
2047 * sizeof (struct dntt_type_block)),
2048 objfile->global_psymbols.next,
2049 objfile->static_psymbols.next);
2052 /* Compute address of the data symbol */
2053 valu = dn_bufp->dsvar.location;
2054 /* Relocate in case it's in a shared library */
2055 if (storage == LOC_STATIC)
2056 valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
2058 /* Luckily, dvar, svar, typedef, and tagdef all
2059 have their "global" bit in the same place, so it works
2060 (though it's bad programming practice) to reference
2061 "dsvar.global" even though we may be looking at
2062 any of the above four types. */
2063 if (dn_bufp->dsvar.global)
2065 add_psymbol_to_list (namestring, strlen (namestring),
2067 &objfile->global_psymbols,
2069 0, language_unknown, objfile);
2073 add_psymbol_to_list (namestring, strlen (namestring),
2075 &objfile->static_psymbols,
2077 0, language_unknown, objfile);
2080 /* For TAGDEF's, the above code added the tagname to the
2081 struct namespace. This will cause tag "t" to be found
2082 on a reference of the form "(struct t) x". But for
2083 C++ classes, "t" will also be a typename, which we
2084 want to find on a reference of the form "ptype t".
2085 Therefore, we also add "t" to the var namespace.
2086 Do the same for enum's due to the way aCC generates
2087 debug info for these (see more extended comment
2088 in hp-symtab-read.c).
2089 We do the same for templates, so that "ptype t"
2090 where "t" is a template also works. */
2091 if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF &&
2092 dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
2094 int global = dn_bufp->dtag.global;
2095 /* Look ahead to see if it's a C++ class */
2096 dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
2097 if (dn_bufp->dblock.kind == DNTT_TYPE_CLASS ||
2098 dn_bufp->dblock.kind == DNTT_TYPE_ENUM ||
2099 dn_bufp->dblock.kind == DNTT_TYPE_TEMPLATE)
2103 add_psymbol_to_list (namestring, strlen (namestring),
2104 VAR_NAMESPACE, storage,
2105 &objfile->global_psymbols,
2106 dn_bufp->dsvar.location,
2107 0, language_unknown, objfile);
2111 add_psymbol_to_list (namestring, strlen (namestring),
2112 VAR_NAMESPACE, storage,
2113 &objfile->static_psymbols,
2114 dn_bufp->dsvar.location,
2115 0, language_unknown, objfile);
2122 case DNTT_TYPE_MEMENUM:
2123 case DNTT_TYPE_CONST:
2124 /* Constants and members of enumerated types. */
2125 SET_NAMESTRING (dn_bufp, &namestring, objfile);
2128 pst = hpread_start_psymtab (objfile, section_offsets,
2131 * sizeof (struct dntt_type_block)),
2132 objfile->global_psymbols.next,
2133 objfile->static_psymbols.next);
2135 if (dn_bufp->dconst.global)
2136 add_psymbol_to_list (namestring, strlen (namestring),
2137 VAR_NAMESPACE, LOC_CONST,
2138 &objfile->global_psymbols, 0,
2139 0, language_unknown, objfile);
2141 add_psymbol_to_list (namestring, strlen (namestring),
2142 VAR_NAMESPACE, LOC_CONST,
2143 &objfile->static_psymbols, 0,
2144 0, language_unknown, objfile);
2152 /* End any pending partial symbol table. */
2155 hpread_end_psymtab (pst, psymtab_include_list, includes_used,
2156 hp_symnum * sizeof (struct dntt_type_block),
2157 0, dependency_list, dependencies_used);
2160 discard_cleanups (old_chain);
2163 /* Perform any local cleanups required when we are done with a particular
2164 objfile. I.E, we are in the process of discarding all symbol information
2165 for an objfile, freeing up all memory held for it, and unlinking the
2166 objfile struct from the global list of known objfiles. */
2169 hpread_symfile_finish (objfile)
2170 struct objfile *objfile;
2172 if (objfile->sym_private != NULL)
2174 mfree (objfile->md, objfile->sym_private);
2179 /* The remaining functions are all for internal use only. */
2181 /* Various small functions to get entries in the debug symbol sections. */
2184 hpread_get_lntt (index, objfile)
2186 struct objfile *objfile;
2188 return (union dnttentry *)
2189 &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
2192 static union dnttentry *
2193 hpread_get_gntt (index, objfile)
2195 struct objfile *objfile;
2197 return (union dnttentry *)
2198 &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
2202 hpread_get_slt (index, objfile)
2204 struct objfile *objfile;
2206 return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
2209 /* Get the low address associated with some symbol (typically the start
2210 of a particular source file or module). Since that information is not
2211 stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
2212 the existance of DNTT_TYPE_FUNCTION symbols. */
2214 static unsigned long
2215 hpread_get_textlow (global, index, objfile, symcount)
2218 struct objfile *objfile;
2221 union dnttentry *dn_bufp;
2222 struct minimal_symbol *msymbol;
2224 /* Look for a DNTT_TYPE_FUNCTION symbol. */
2225 if (index < symcount) /* symcount is the number of symbols in */
2226 { /* the dbinfo, LNTT table */
2230 dn_bufp = hpread_get_gntt (index++, objfile);
2232 dn_bufp = hpread_get_lntt (index++, objfile);
2234 while (dn_bufp->dblock.kind != DNTT_TYPE_FUNCTION
2235 && dn_bufp->dblock.kind != DNTT_TYPE_DOC_FUNCTION
2236 && dn_bufp->dblock.kind != DNTT_TYPE_END
2237 && index < symcount);
2240 /* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This
2241 might happen when a sourcefile has no functions. */
2242 if (dn_bufp->dblock.kind == DNTT_TYPE_END)
2245 /* Avoid going past the end of the LNTT file */
2246 if (index == symcount)
2249 /* The minimal symbols are typically more accurate for some reason. */
2250 if (dn_bufp->dblock.kind == DNTT_TYPE_FUNCTION)
2251 msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL,
2253 else /* must be a DNTT_TYPE_DOC_FUNCTION */
2254 msymbol = lookup_minimal_symbol (dn_bufp->ddocfunc.name + VT (objfile), NULL,
2258 return SYMBOL_VALUE_ADDRESS (msymbol);
2260 return dn_bufp->dfunc.lowaddr;
2263 /* Allocate and partially fill a partial symtab. It will be
2264 completely filled at the end of the symbol list.
2266 SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
2267 is the address relative to which its symbols are (incremental) or 0
2270 static struct partial_symtab *
2271 hpread_start_psymtab (objfile, section_offsets,
2272 filename, textlow, ldsymoff, global_syms, static_syms)
2273 struct objfile *objfile;
2274 struct section_offsets *section_offsets;
2278 struct partial_symbol **global_syms;
2279 struct partial_symbol **static_syms;
2281 int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
2282 extern void hpread_psymtab_to_symtab ();
2283 struct partial_symtab *result =
2284 start_psymtab_common (objfile, section_offsets,
2285 filename, textlow, global_syms, static_syms);
2287 result->textlow += offset;
2288 result->read_symtab_private = (char *)
2289 obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
2290 LDSYMOFF (result) = ldsymoff;
2291 result->read_symtab = hpread_psymtab_to_symtab;
2297 /* Close off the current usage of PST.
2298 Returns PST or NULL if the partial symtab was empty and thrown away.
2300 capping_symbol_offset --Byte index in LNTT or GNTT of the
2301 last symbol processed during the build
2302 of the previous pst.
2304 FIXME: List variables and peculiarities of same. */
2306 static struct partial_symtab *
2307 hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
2308 capping_text, dependency_list, number_dependencies)
2309 struct partial_symtab *pst;
2310 char **include_list;
2312 int capping_symbol_offset;
2313 CORE_ADDR capping_text;
2314 struct partial_symtab **dependency_list;
2315 int number_dependencies;
2318 struct objfile *objfile = pst->objfile;
2319 int offset = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
2322 /* Turn on to see what kind of a psymtab we've built. */
2323 static int dumping = 0;
2326 if (capping_symbol_offset != -1)
2327 LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
2330 pst->texthigh = capping_text + offset;
2332 pst->n_global_syms =
2333 objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
2334 pst->n_static_syms =
2335 objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset);
2340 printf ("\nPst %s, LDSYMOFF %x (%x), LDSYMLEN %x (%x), globals %d, statics %d\n",
2343 LDSYMOFF (pst) / sizeof (struct dntt_type_block),
2345 LDSYMLEN (pst) / sizeof (struct dntt_type_block),
2346 pst->n_global_syms, pst->n_static_syms);
2350 pst->number_of_dependencies = number_dependencies;
2351 if (number_dependencies)
2353 pst->dependencies = (struct partial_symtab **)
2354 obstack_alloc (&objfile->psymbol_obstack,
2355 number_dependencies * sizeof (struct partial_symtab *));
2356 memcpy (pst->dependencies, dependency_list,
2357 number_dependencies * sizeof (struct partial_symtab *));
2360 pst->dependencies = 0;
2362 for (i = 0; i < num_includes; i++)
2364 struct partial_symtab *subpst =
2365 allocate_psymtab (include_list[i], objfile);
2367 subpst->section_offsets = pst->section_offsets;
2368 subpst->read_symtab_private =
2369 (char *) obstack_alloc (&objfile->psymbol_obstack,
2370 sizeof (struct symloc));
2374 subpst->texthigh = 0;
2376 /* We could save slight bits of space by only making one of these,
2377 shared by the entire set of include files. FIXME-someday. */
2378 subpst->dependencies = (struct partial_symtab **)
2379 obstack_alloc (&objfile->psymbol_obstack,
2380 sizeof (struct partial_symtab *));
2381 subpst->dependencies[0] = pst;
2382 subpst->number_of_dependencies = 1;
2384 subpst->globals_offset =
2385 subpst->n_global_syms =
2386 subpst->statics_offset =
2387 subpst->n_static_syms = 0;
2391 subpst->read_symtab = pst->read_symtab;
2394 sort_pst_symbols (pst);
2396 /* If there is already a psymtab or symtab for a file of this name, remove it.
2397 (If there is a symtab, more drastic things also happen.)
2398 This happens in VxWorks. */
2399 free_named_symtabs (pst->filename);
2401 if (num_includes == 0
2402 && number_dependencies == 0
2403 && pst->n_global_syms == 0
2404 && pst->n_static_syms == 0)
2406 /* Throw away this psymtab, it's empty. We can't deallocate it, since
2407 it is on the obstack, but we can forget to chain it on the list.
2408 Empty psymtabs happen as a result of header files which don't have
2409 any symbols in them. There can be a lot of them. But this check
2410 is wrong, in that a psymtab with N_SLINE entries but nothing else
2411 is not empty, but we don't realize that. Fixing that without slowing
2412 things down might be tricky.
2413 It's also wrong if we're using the quick look-up tables, as
2414 we can get empty psymtabs from modules with no routines in
2417 discard_psymtab (pst);
2419 /* Indicate that psymtab was thrown away. */
2420 pst = (struct partial_symtab *) NULL;
2427 /* End of hp-psymtab-read.c */
2429 /* Set indentation to 4 spaces for Emacs; this file is
2430 mostly non-GNU-ish in its style :-( */
2433 ***c - basic - offset:4