xref: /dflybsd-src/contrib/gdb-7/gdb/stabsread.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Include file for stabs debugging format support functions.
2*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
35796c8dcSSimon Schubert 
45796c8dcSSimon Schubert    This file is part of GDB.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
75796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
85796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
95796c8dcSSimon Schubert    (at your option) any later version.
105796c8dcSSimon Schubert 
115796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
125796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
135796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
145796c8dcSSimon Schubert    GNU General Public License for more details.
155796c8dcSSimon Schubert 
165796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
175796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert struct objfile;
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert /* Definitions, prototypes, etc for stabs debugging format support
225796c8dcSSimon Schubert    functions.
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert    Variables declared in this file can be defined by #define-ing
255796c8dcSSimon Schubert    the name EXTERN to null.  It is used to declare variables that
265796c8dcSSimon Schubert    are normally extern, but which get defined in a single module
275796c8dcSSimon Schubert    using this technique.  */
285796c8dcSSimon Schubert 
295796c8dcSSimon Schubert #ifndef EXTERN
305796c8dcSSimon Schubert #define	EXTERN extern
315796c8dcSSimon Schubert #endif
325796c8dcSSimon Schubert 
335796c8dcSSimon Schubert /* Hash table of global symbols whose values are not known yet.
345796c8dcSSimon Schubert    They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
355796c8dcSSimon Schubert    have the correct data for that slot yet.
365796c8dcSSimon Schubert 
375796c8dcSSimon Schubert    The use of the LOC_BLOCK code in this chain is nonstandard--
385796c8dcSSimon Schubert    it refers to a FORTRAN common block rather than the usual meaning, and
395796c8dcSSimon Schubert    the such LOC_BLOCK symbols use their fields in nonstandard ways.  */
405796c8dcSSimon Schubert 
415796c8dcSSimon Schubert EXTERN struct symbol *global_sym_chain[HASHSIZE];
425796c8dcSSimon Schubert 
435796c8dcSSimon Schubert extern void common_block_start (char *, struct objfile *);
445796c8dcSSimon Schubert extern void common_block_end (struct objfile *);
455796c8dcSSimon Schubert 
465796c8dcSSimon Schubert /* Kludge for xcoffread.c */
475796c8dcSSimon Schubert 
485796c8dcSSimon Schubert struct pending_stabs
495796c8dcSSimon Schubert   {
505796c8dcSSimon Schubert     int count;
515796c8dcSSimon Schubert     int length;
525796c8dcSSimon Schubert     char *stab[1];
535796c8dcSSimon Schubert   };
545796c8dcSSimon Schubert 
555796c8dcSSimon Schubert EXTERN struct pending_stabs *global_stabs;
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert /* The type code that process_one_symbol saw on its previous invocation.
585796c8dcSSimon Schubert    Used to detect pairs of N_SO symbols.  */
595796c8dcSSimon Schubert 
605796c8dcSSimon Schubert EXTERN int previous_stab_code;
615796c8dcSSimon Schubert 
62c50c785cSJohn Marino /* Support for Sun changes to dbx symbol format.  */
635796c8dcSSimon Schubert 
645796c8dcSSimon Schubert /* For each identified header file, we have a table of types defined
655796c8dcSSimon Schubert    in that header file.
665796c8dcSSimon Schubert 
675796c8dcSSimon Schubert    header_files maps header file names to their type tables.
685796c8dcSSimon Schubert    It is a vector of n_header_files elements.
695796c8dcSSimon Schubert    Each element describes one header file.
705796c8dcSSimon Schubert    It contains a vector of types.
715796c8dcSSimon Schubert 
725796c8dcSSimon Schubert    Sometimes it can happen that the same header file produces
735796c8dcSSimon Schubert    different results when included in different places.
745796c8dcSSimon Schubert    This can result from conditionals or from different
755796c8dcSSimon Schubert    things done before including the file.
765796c8dcSSimon Schubert    When this happens, there are multiple entries for the file in this table,
775796c8dcSSimon Schubert    one entry for each distinct set of results.
785796c8dcSSimon Schubert    The entries are distinguished by the INSTANCE field.
795796c8dcSSimon Schubert    The INSTANCE field appears in the N_BINCL and N_EXCL symbol table and is
805796c8dcSSimon Schubert    used to match header-file references to their corresponding data.  */
815796c8dcSSimon Schubert 
825796c8dcSSimon Schubert struct header_file
835796c8dcSSimon Schubert   {
845796c8dcSSimon Schubert 
855796c8dcSSimon Schubert     /* Name of header file */
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert     char *name;
885796c8dcSSimon Schubert 
89c50c785cSJohn Marino     /* Numeric code distinguishing instances of one header file that
90c50c785cSJohn Marino        produced different results when included.  It comes from the
91c50c785cSJohn Marino        N_BINCL or N_EXCL.  */
925796c8dcSSimon Schubert 
935796c8dcSSimon Schubert     int instance;
945796c8dcSSimon Schubert 
955796c8dcSSimon Schubert     /* Pointer to vector of types */
965796c8dcSSimon Schubert 
975796c8dcSSimon Schubert     struct type **vector;
985796c8dcSSimon Schubert 
995796c8dcSSimon Schubert     /* Allocated length (# elts) of that vector */
1005796c8dcSSimon Schubert 
1015796c8dcSSimon Schubert     int length;
1025796c8dcSSimon Schubert 
1035796c8dcSSimon Schubert   };
1045796c8dcSSimon Schubert 
1055796c8dcSSimon Schubert /* The table of header_files of this OBJFILE.  */
1065796c8dcSSimon Schubert #define HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->header_files)
1075796c8dcSSimon Schubert 
1085796c8dcSSimon Schubert /* The actual length of HEADER_FILES.  */
1095796c8dcSSimon Schubert #define N_HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->n_header_files)
1105796c8dcSSimon Schubert 
1115796c8dcSSimon Schubert /* The allocated lengh of HEADER_FILES.  */
1125796c8dcSSimon Schubert #define N_ALLOCATED_HEADER_FILES(OBJFILE) \
1135796c8dcSSimon Schubert   (DBX_SYMFILE_INFO (OBJFILE)->n_allocated_header_files)
1145796c8dcSSimon Schubert 
1155796c8dcSSimon Schubert /* Within each object file, various header files are assigned numbers.
1165796c8dcSSimon Schubert    A type is defined or referred to with a pair of numbers
1175796c8dcSSimon Schubert    (FILENUM,TYPENUM) where FILENUM is the number of the header file
1185796c8dcSSimon Schubert    and TYPENUM is the number within that header file.
1195796c8dcSSimon Schubert    TYPENUM is the index within the vector of types for that header file.
1205796c8dcSSimon Schubert 
1215796c8dcSSimon Schubert    FILENUM == 0 is special; it refers to the main source of the object file,
1225796c8dcSSimon Schubert    and not to any header file.  FILENUM != 1 is interpreted by looking it up
1235796c8dcSSimon Schubert    in the following table, which contains indices in header_files.  */
1245796c8dcSSimon Schubert 
1255796c8dcSSimon Schubert EXTERN int *this_object_header_files;
1265796c8dcSSimon Schubert 
1275796c8dcSSimon Schubert EXTERN int n_this_object_header_files;
1285796c8dcSSimon Schubert 
1295796c8dcSSimon Schubert EXTERN int n_allocated_this_object_header_files;
1305796c8dcSSimon Schubert 
131*ef5ccd6cSJohn Marino extern void cleanup_undefined_stabs_types (struct objfile *);
1325796c8dcSSimon Schubert 
1335796c8dcSSimon Schubert extern long read_number (char **, int);
1345796c8dcSSimon Schubert 
1355796c8dcSSimon Schubert extern struct symbol *define_symbol (CORE_ADDR, char *, int, int,
1365796c8dcSSimon Schubert 				     struct objfile *);
1375796c8dcSSimon Schubert 
1385796c8dcSSimon Schubert extern void stabsread_init (void);
1395796c8dcSSimon Schubert 
1405796c8dcSSimon Schubert extern void stabsread_new_init (void);
1415796c8dcSSimon Schubert 
1425796c8dcSSimon Schubert extern void start_stabs (void);
1435796c8dcSSimon Schubert 
1445796c8dcSSimon Schubert extern void end_stabs (void);
1455796c8dcSSimon Schubert 
1465796c8dcSSimon Schubert extern void finish_global_stabs (struct objfile *objfile);
1475796c8dcSSimon Schubert 
1485796c8dcSSimon Schubert /* COFF files can have multiple .stab sections, if they are linked
1495796c8dcSSimon Schubert    using --split-by-reloc.  This linked list is used to pass the
1505796c8dcSSimon Schubert    information into the functions in dbxread.c.  */
1515796c8dcSSimon Schubert struct stab_section_list
1525796c8dcSSimon Schubert   {
1535796c8dcSSimon Schubert     /* Next in list.  */
1545796c8dcSSimon Schubert     struct stab_section_list *next;
1555796c8dcSSimon Schubert 
1565796c8dcSSimon Schubert     /* Stab section.  */
1575796c8dcSSimon Schubert     asection *section;
1585796c8dcSSimon Schubert   };
1595796c8dcSSimon Schubert 
1605796c8dcSSimon Schubert /* Functions exported by dbxread.c.  These are not in stabsread.c because
1615796c8dcSSimon Schubert    they are only used by some stabs readers.  */
1625796c8dcSSimon Schubert 
163*ef5ccd6cSJohn Marino extern struct partial_symtab *end_psymtab (struct objfile *objfile,
164*ef5ccd6cSJohn Marino 					   struct partial_symtab *pst,
165*ef5ccd6cSJohn Marino 					   const char **include_list,
1665796c8dcSSimon Schubert 					   int num_includes,
1675796c8dcSSimon Schubert 					   int capping_symbol_offset,
1685796c8dcSSimon Schubert 					   CORE_ADDR capping_text,
1695796c8dcSSimon Schubert 					   struct partial_symtab
1705796c8dcSSimon Schubert 					   **dependency_list,
1715796c8dcSSimon Schubert 					   int number_dependencies,
1725796c8dcSSimon Schubert 					   int textlow_not_set);
1735796c8dcSSimon Schubert 
1745796c8dcSSimon Schubert extern void process_one_symbol (int, int, CORE_ADDR, char *,
1755796c8dcSSimon Schubert 				struct section_offsets *, struct objfile *);
1765796c8dcSSimon Schubert 
1775796c8dcSSimon Schubert extern void elfstab_build_psymtabs (struct objfile *objfile,
1785796c8dcSSimon Schubert 				    asection *stabsect,
1795796c8dcSSimon Schubert 				    file_ptr stabstroffset,
1805796c8dcSSimon Schubert 				    unsigned int stabstrsize);
1815796c8dcSSimon Schubert 
1825796c8dcSSimon Schubert extern void coffstab_build_psymtabs
1835796c8dcSSimon Schubert   (struct objfile *objfile,
1845796c8dcSSimon Schubert    CORE_ADDR textaddr, unsigned int textsize,
1855796c8dcSSimon Schubert    struct stab_section_list *stabs,
1865796c8dcSSimon Schubert    file_ptr stabstroffset, unsigned int stabstrsize);
1875796c8dcSSimon Schubert 
188cf7f2e2dSJohn Marino extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
189cf7f2e2dSJohn Marino 				     char *stabstr_name, char *text_name);
1905796c8dcSSimon Schubert 
1915796c8dcSSimon Schubert extern void elfstab_offset_sections (struct objfile *,
1925796c8dcSSimon Schubert 				     struct partial_symtab *);
1935796c8dcSSimon Schubert extern int symbol_reference_defined (char **);
1945796c8dcSSimon Schubert 
1955796c8dcSSimon Schubert extern void ref_add (int, struct symbol *, char *, CORE_ADDR);
1965796c8dcSSimon Schubert 
1975796c8dcSSimon Schubert extern struct symbol *ref_search (int);
1985796c8dcSSimon Schubert 
1995796c8dcSSimon Schubert extern void free_header_files (void);
2005796c8dcSSimon Schubert 
2015796c8dcSSimon Schubert extern void init_header_files (void);
2025796c8dcSSimon Schubert 
2035796c8dcSSimon Schubert #undef EXTERN
204