119370Spst/* Include file for stabs debugging format support functions.
298944Sobrien   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
3130803Smarcel   1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
419370Spst
598944Sobrien   This file is part of GDB.
619370Spst
798944Sobrien   This program is free software; you can redistribute it and/or modify
898944Sobrien   it under the terms of the GNU General Public License as published by
998944Sobrien   the Free Software Foundation; either version 2 of the License, or
1098944Sobrien   (at your option) any later version.
1119370Spst
1298944Sobrien   This program is distributed in the hope that it will be useful,
1398944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1498944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1598944Sobrien   GNU General Public License for more details.
1619370Spst
1798944Sobrien   You should have received a copy of the GNU General Public License
1898944Sobrien   along with this program; if not, write to the Free Software
1998944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2098944Sobrien   Boston, MA 02111-1307, USA.  */
2119370Spst
22130803Smarcelstruct objfile;
23130803Smarcel
2419370Spst/* Definitions, prototypes, etc for stabs debugging format support
2519370Spst   functions.
2619370Spst
2719370Spst   Variables declared in this file can be defined by #define-ing
2819370Spst   the name EXTERN to null.  It is used to declare variables that
2919370Spst   are normally extern, but which get defined in a single module
3019370Spst   using this technique.  */
3119370Spst
3219370Spst#ifndef EXTERN
3319370Spst#define	EXTERN extern
3419370Spst#endif
3519370Spst
3619370Spst/* Hash table of global symbols whose values are not known yet.
3719370Spst   They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
3819370Spst   have the correct data for that slot yet.
3919370Spst
4019370Spst   The use of the LOC_BLOCK code in this chain is nonstandard--
4119370Spst   it refers to a FORTRAN common block rather than the usual meaning, and
4219370Spst   the such LOC_BLOCK symbols use their fields in nonstandard ways.  */
4319370Spst
4419370SpstEXTERN struct symbol *global_sym_chain[HASHSIZE];
4519370Spst
4698944Sobrienextern void common_block_start (char *, struct objfile *);
4798944Sobrienextern void common_block_end (struct objfile *);
4819370Spst
4919370Spst/* Kludge for xcoffread.c */
5019370Spst
5119370Spststruct pending_stabs
5298944Sobrien  {
5398944Sobrien    int count;
5498944Sobrien    int length;
5598944Sobrien    char *stab[1];
5698944Sobrien  };
5719370Spst
5819370SpstEXTERN struct pending_stabs *global_stabs;
5919370Spst
6019370Spst/* The type code that process_one_symbol saw on its previous invocation.
6119370Spst   Used to detect pairs of N_SO symbols. */
6219370Spst
6319370SpstEXTERN int previous_stab_code;
6419370Spst
6519370Spst/* Support for Sun changes to dbx symbol format */
6619370Spst
6719370Spst/* For each identified header file, we have a table of types defined
6819370Spst   in that header file.
6919370Spst
7019370Spst   header_files maps header file names to their type tables.
7119370Spst   It is a vector of n_header_files elements.
7219370Spst   Each element describes one header file.
7319370Spst   It contains a vector of types.
7419370Spst
7519370Spst   Sometimes it can happen that the same header file produces
7619370Spst   different results when included in different places.
7719370Spst   This can result from conditionals or from different
7819370Spst   things done before including the file.
7919370Spst   When this happens, there are multiple entries for the file in this table,
8019370Spst   one entry for each distinct set of results.
8119370Spst   The entries are distinguished by the INSTANCE field.
8219370Spst   The INSTANCE field appears in the N_BINCL and N_EXCL symbol table and is
8319370Spst   used to match header-file references to their corresponding data.  */
8419370Spst
8519370Spststruct header_file
8698944Sobrien  {
8719370Spst
8898944Sobrien    /* Name of header file */
8919370Spst
9098944Sobrien    char *name;
9119370Spst
9298944Sobrien    /* Numeric code distinguishing instances of one header file that produced
9398944Sobrien       different results when included.  It comes from the N_BINCL or N_EXCL. */
9419370Spst
9598944Sobrien    int instance;
9619370Spst
9798944Sobrien    /* Pointer to vector of types */
9819370Spst
9998944Sobrien    struct type **vector;
10019370Spst
10198944Sobrien    /* Allocated length (# elts) of that vector */
10219370Spst
10398944Sobrien    int length;
10419370Spst
10598944Sobrien  };
10698944Sobrien
10746283Sdfr/* The table of header_files of this OBJFILE. */
10846283Sdfr#define HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->header_files)
10919370Spst
11046283Sdfr/* The actual length of HEADER_FILES. */
11146283Sdfr#define N_HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->n_header_files)
11219370Spst
11346283Sdfr/* The allocated lengh of HEADER_FILES. */
11446283Sdfr#define N_ALLOCATED_HEADER_FILES(OBJFILE) \
11546283Sdfr  (DBX_SYMFILE_INFO (OBJFILE)->n_allocated_header_files)
11619370Spst
11719370Spst/* Within each object file, various header files are assigned numbers.
11819370Spst   A type is defined or referred to with a pair of numbers
11919370Spst   (FILENUM,TYPENUM) where FILENUM is the number of the header file
12019370Spst   and TYPENUM is the number within that header file.
12119370Spst   TYPENUM is the index within the vector of types for that header file.
12219370Spst
12346283Sdfr   FILENUM == 0 is special; it refers to the main source of the object file,
12419370Spst   and not to any header file.  FILENUM != 1 is interpreted by looking it up
12519370Spst   in the following table, which contains indices in header_files.  */
12619370Spst
12719370SpstEXTERN int *this_object_header_files;
12819370Spst
12919370SpstEXTERN int n_this_object_header_files;
13019370Spst
13119370SpstEXTERN int n_allocated_this_object_header_files;
13219370Spst
13398944Sobrienextern void cleanup_undefined_types (void);
13419370Spst
13598944Sobrienextern long read_number (char **, int);
13619370Spst
13798944Sobrienextern struct symbol *define_symbol (CORE_ADDR, char *, int, int,
13898944Sobrien				     struct objfile *);
13919370Spst
14098944Sobrienextern void stabsread_init (void);
14119370Spst
14298944Sobrienextern void stabsread_new_init (void);
14319370Spst
14498944Sobrienextern void start_stabs (void);
14519370Spst
14698944Sobrienextern void end_stabs (void);
14719370Spst
14898944Sobrienextern void finish_global_stabs (struct objfile *objfile);
14998944Sobrien
15019370Spst/* COFF files can have multiple .stab sections, if they are linked
15119370Spst   using --split-by-reloc.  This linked list is used to pass the
15219370Spst   information into the functions in dbxread.c.  */
15319370Spststruct stab_section_list
15498944Sobrien  {
15598944Sobrien    /* Next in list.  */
15698944Sobrien    struct stab_section_list *next;
15719370Spst
15898944Sobrien    /* Stab section.  */
15998944Sobrien    asection *section;
16098944Sobrien  };
16119370Spst
16219370Spst/* Functions exported by dbxread.c.  These are not in stabsread.c because
16319370Spst   they are only used by some stabs readers.  */
16419370Spst
16598944Sobrienextern struct partial_symtab *end_psymtab (struct partial_symtab *pst,
16698944Sobrien					   char **include_list,
16798944Sobrien					   int num_includes,
16898944Sobrien					   int capping_symbol_offset,
16998944Sobrien					   CORE_ADDR capping_text,
17098944Sobrien					   struct partial_symtab
17198944Sobrien					   **dependency_list,
17298944Sobrien					   int number_dependencies,
17398944Sobrien					   int textlow_not_set);
17419370Spst
175130803Smarcelextern void process_one_symbol (int, int, CORE_ADDR, char *,
176130803Smarcel				struct section_offsets *, struct objfile *);
17719370Spst
178130803Smarcelextern void elfstab_build_psymtabs (struct objfile *objfile,
179130803Smarcel				    int mainline,
180130803Smarcel				    asection *stabsect,
181130803Smarcel				    file_ptr stabstroffset,
182130803Smarcel				    unsigned int stabstrsize);
18319370Spst
18419370Spstextern void coffstab_build_psymtabs
18598944Sobrien  (struct objfile *objfile,
18698944Sobrien   int mainline,
18798944Sobrien   CORE_ADDR textaddr, unsigned int textsize,
18898944Sobrien   struct stab_section_list *stabs,
18998944Sobrien   file_ptr stabstroffset, unsigned int stabstrsize);
19019370Spst
19119370Spstextern void stabsect_build_psymtabs
19298944Sobrien  (struct objfile *objfile,
19398944Sobrien   int mainline, char *stab_name, char *stabstr_name, char *text_name);
19419370Spst
19598944Sobrienextern void elfstab_offset_sections (struct objfile *,
19698944Sobrien				     struct partial_symtab *);
19798944Sobrienextern int symbol_reference_defined (char **);
19846283Sdfr
19998944Sobrienextern void ref_add (int, struct symbol *, char *, CORE_ADDR);
20046283Sdfr
20198944Sobrienextern struct symbol *ref_search (int);
20246283Sdfr
20398944Sobrienextern void free_header_files (void);
20498944Sobrien
20598944Sobrienextern void init_header_files (void);
20698944Sobrien
20719370Spst#undef EXTERN
208