119370Spst/* Definitions for symbol-reading containing "stabs", for GDB.
298944Sobrien   Copyright 1992, 1993, 1995, 1996, 1997, 1999, 2000
398944Sobrien   Free Software Foundation, Inc.
419370Spst   Contributed by Cygnus Support.  Written by John Gilmore.
519370Spst
698944Sobrien   This file is part of GDB.
719370Spst
898944Sobrien   This program is free software; you can redistribute it and/or modify
998944Sobrien   it under the terms of the GNU General Public License as published by
1098944Sobrien   the Free Software Foundation; either version 2 of the License, or
1198944Sobrien   (at your option) any later version.
1219370Spst
1398944Sobrien   This program is distributed in the hope that it will be useful,
1498944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1598944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1698944Sobrien   GNU General Public License for more details.
1719370Spst
1898944Sobrien   You should have received a copy of the GNU General Public License
1998944Sobrien   along with this program; if not, write to the Free Software
2098944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2198944Sobrien   Boston, MA 02111-1307, USA.  */
2219370Spst
2319370Spst/* This file exists to hold the common definitions required of most of
2419370Spst   the symbol-readers that end up using stabs.  The common use of
2519370Spst   these `symbol-type-specific' customizations of the generic data
2619370Spst   structures makes the stabs-oriented symbol readers able to call
2719370Spst   each others' functions as required.  */
2819370Spst
2919370Spst#if !defined (GDBSTABS_H)
3019370Spst#define GDBSTABS_H
3119370Spst
3219370Spst/* The stab_section_info chain remembers info from the ELF symbol table,
3319370Spst   while psymtabs are being built for the other symbol tables in the
3419370Spst   objfile.  It is destroyed at the complation of psymtab-reading.
3519370Spst   Any info that was used from it has been copied into psymtabs.  */
3619370Spst
3798944Sobrienstruct stab_section_info
3898944Sobrien  {
3998944Sobrien    char *filename;
4098944Sobrien    struct stab_section_info *next;
4198944Sobrien    int found;			/* Count of times it's found in searching */
42130803Smarcel    size_t num_sections;
43130803Smarcel    CORE_ADDR sections[1];
4498944Sobrien  };
4519370Spst
4619370Spst/* Information is passed among various dbxread routines for accessing
4719370Spst   symbol files.  A pointer to this structure is kept in the sym_stab_info
4819370Spst   field of the objfile struct.  */
4946283Sdfr
5098944Sobrienstruct dbx_symfile_info
5198944Sobrien  {
5298944Sobrien    CORE_ADDR text_addr;	/* Start of text section */
5398944Sobrien    int text_size;		/* Size of text section */
5498944Sobrien    int symcount;		/* How many symbols are there in the file */
5598944Sobrien    char *stringtab;		/* The actual string table */
5698944Sobrien    int stringtab_size;		/* Its size */
5798944Sobrien    file_ptr symtab_offset;	/* Offset in file to symbol table */
5898944Sobrien    int symbol_size;		/* Bytes in a single symbol */
5998944Sobrien    struct stab_section_info *stab_section_info;	/* section starting points
6098944Sobrien							   of the original .o files before linking. */
6146283Sdfr
6298944Sobrien    /* See stabsread.h for the use of the following. */
6398944Sobrien    struct header_file *header_files;
6498944Sobrien    int n_header_files;
6598944Sobrien    int n_allocated_header_files;
6619370Spst
6798944Sobrien    /* Pointers to BFD sections.  These are used to speed up the building of
6898944Sobrien       minimal symbols.  */
6998944Sobrien    asection *text_section;
7098944Sobrien    asection *data_section;
7198944Sobrien    asection *bss_section;
72130803Smarcel
73130803Smarcel    /* Pointer to the separate ".stab" section, if there is one.  */
74130803Smarcel    asection *stab_section;
7598944Sobrien  };
7698944Sobrien
7746283Sdfr#define DBX_SYMFILE_INFO(o)	((o)->sym_stab_info)
7819370Spst#define DBX_TEXT_ADDR(o)	(DBX_SYMFILE_INFO(o)->text_addr)
7919370Spst#define DBX_TEXT_SIZE(o)	(DBX_SYMFILE_INFO(o)->text_size)
8019370Spst#define DBX_SYMCOUNT(o)		(DBX_SYMFILE_INFO(o)->symcount)
8119370Spst#define DBX_STRINGTAB(o)	(DBX_SYMFILE_INFO(o)->stringtab)
8219370Spst#define DBX_STRINGTAB_SIZE(o)	(DBX_SYMFILE_INFO(o)->stringtab_size)
8319370Spst#define DBX_SYMTAB_OFFSET(o)	(DBX_SYMFILE_INFO(o)->symtab_offset)
8419370Spst#define DBX_SYMBOL_SIZE(o)	(DBX_SYMFILE_INFO(o)->symbol_size)
8546283Sdfr#define DBX_TEXT_SECTION(o)	(DBX_SYMFILE_INFO(o)->text_section)
8646283Sdfr#define DBX_DATA_SECTION(o)	(DBX_SYMFILE_INFO(o)->data_section)
8746283Sdfr#define DBX_BSS_SECTION(o)	(DBX_SYMFILE_INFO(o)->bss_section)
88130803Smarcel#define DBX_STAB_SECTION(o)	(DBX_SYMFILE_INFO(o)->stab_section)
8919370Spst
9019370Spst#endif /* GDBSTABS_H */
91