xref: /dflybsd-src/contrib/gdb-7/gdb/gdb-stabs.h (revision c50c785cb49e9377ca78104c5540c7b33f768771)
15796c8dcSSimon Schubert /* Definitions for symbol-reading containing "stabs", for GDB.
2cf7f2e2dSJohn Marino    Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2007, 2008, 2009,
3*c50c785cSJohn Marino    2010, 2011 Free Software Foundation, Inc.
45796c8dcSSimon Schubert    Contributed by Cygnus Support.  Written by John Gilmore.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This file is part of GDB.
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
95796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
105796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
115796c8dcSSimon Schubert    (at your option) any later version.
125796c8dcSSimon Schubert 
135796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
145796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
155796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165796c8dcSSimon Schubert    GNU General Public License for more details.
175796c8dcSSimon Schubert 
185796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
195796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert /* This file exists to hold the common definitions required of most of
225796c8dcSSimon Schubert    the symbol-readers that end up using stabs.  The common use of
235796c8dcSSimon Schubert    these `symbol-type-specific' customizations of the generic data
245796c8dcSSimon Schubert    structures makes the stabs-oriented symbol readers able to call
255796c8dcSSimon Schubert    each others' functions as required.  */
265796c8dcSSimon Schubert 
275796c8dcSSimon Schubert #if !defined (GDBSTABS_H)
285796c8dcSSimon Schubert #define GDBSTABS_H
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert /* The stab_section_info chain remembers info from the ELF symbol table,
315796c8dcSSimon Schubert    while psymtabs are being built for the other symbol tables in the
325796c8dcSSimon Schubert    objfile.  It is destroyed at the complation of psymtab-reading.
335796c8dcSSimon Schubert    Any info that was used from it has been copied into psymtabs.  */
345796c8dcSSimon Schubert 
355796c8dcSSimon Schubert struct stab_section_info
365796c8dcSSimon Schubert   {
375796c8dcSSimon Schubert     char *filename;
385796c8dcSSimon Schubert     struct stab_section_info *next;
39*c50c785cSJohn Marino     int found;			/* Count of times it's found in searching.  */
405796c8dcSSimon Schubert     size_t num_sections;
415796c8dcSSimon Schubert     CORE_ADDR sections[1];
425796c8dcSSimon Schubert   };
435796c8dcSSimon Schubert 
445796c8dcSSimon Schubert /* Information is passed among various dbxread routines for accessing
455796c8dcSSimon Schubert    symbol files.  A pointer to this structure is kept in the
465796c8dcSSimon Schubert    deprecated_sym_stab_info field of the objfile struct.  */
475796c8dcSSimon Schubert 
485796c8dcSSimon Schubert struct dbx_symfile_info
495796c8dcSSimon Schubert   {
505796c8dcSSimon Schubert     CORE_ADDR text_addr;	/* Start of text section */
515796c8dcSSimon Schubert     int text_size;		/* Size of text section */
525796c8dcSSimon Schubert     int symcount;		/* How many symbols are there in the file */
535796c8dcSSimon Schubert     char *stringtab;		/* The actual string table */
545796c8dcSSimon Schubert     int stringtab_size;		/* Its size */
555796c8dcSSimon Schubert     file_ptr symtab_offset;	/* Offset in file to symbol table */
565796c8dcSSimon Schubert     int symbol_size;		/* Bytes in a single symbol */
57*c50c785cSJohn Marino     struct stab_section_info *stab_section_info;    /* Section starting points
58*c50c785cSJohn Marino 						       of the original .o files
59*c50c785cSJohn Marino 						       before linking.  */
605796c8dcSSimon Schubert 
615796c8dcSSimon Schubert     /* See stabsread.h for the use of the following.  */
625796c8dcSSimon Schubert     struct header_file *header_files;
635796c8dcSSimon Schubert     int n_header_files;
645796c8dcSSimon Schubert     int n_allocated_header_files;
655796c8dcSSimon Schubert 
665796c8dcSSimon Schubert     /* Pointers to BFD sections.  These are used to speed up the building of
675796c8dcSSimon Schubert        minimal symbols.  */
685796c8dcSSimon Schubert     asection *text_section;
695796c8dcSSimon Schubert     asection *data_section;
705796c8dcSSimon Schubert     asection *bss_section;
715796c8dcSSimon Schubert 
725796c8dcSSimon Schubert     /* Pointer to the separate ".stab" section, if there is one.  */
735796c8dcSSimon Schubert     asection *stab_section;
745796c8dcSSimon Schubert   };
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert #define DBX_SYMFILE_INFO(o)	((o)->deprecated_sym_stab_info)
775796c8dcSSimon Schubert #define DBX_TEXT_ADDR(o)	(DBX_SYMFILE_INFO(o)->text_addr)
785796c8dcSSimon Schubert #define DBX_TEXT_SIZE(o)	(DBX_SYMFILE_INFO(o)->text_size)
795796c8dcSSimon Schubert #define DBX_SYMCOUNT(o)		(DBX_SYMFILE_INFO(o)->symcount)
805796c8dcSSimon Schubert #define DBX_STRINGTAB(o)	(DBX_SYMFILE_INFO(o)->stringtab)
815796c8dcSSimon Schubert #define DBX_STRINGTAB_SIZE(o)	(DBX_SYMFILE_INFO(o)->stringtab_size)
825796c8dcSSimon Schubert #define DBX_SYMTAB_OFFSET(o)	(DBX_SYMFILE_INFO(o)->symtab_offset)
835796c8dcSSimon Schubert #define DBX_SYMBOL_SIZE(o)	(DBX_SYMFILE_INFO(o)->symbol_size)
845796c8dcSSimon Schubert #define DBX_TEXT_SECTION(o)	(DBX_SYMFILE_INFO(o)->text_section)
855796c8dcSSimon Schubert #define DBX_DATA_SECTION(o)	(DBX_SYMFILE_INFO(o)->data_section)
865796c8dcSSimon Schubert #define DBX_BSS_SECTION(o)	(DBX_SYMFILE_INFO(o)->bss_section)
875796c8dcSSimon Schubert #define DBX_STAB_SECTION(o)	(DBX_SYMFILE_INFO(o)->stab_section)
885796c8dcSSimon Schubert 
895796c8dcSSimon Schubert #endif /* GDBSTABS_H */
90