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