xref: /dflybsd-src/contrib/gdb-7/gdb/gdb-stabs.h (revision 5796c8dc12c637f18a1740c26afd8d40ffa9b719)
1*5796c8dcSSimon Schubert /* Definitions for symbol-reading containing "stabs", for GDB.
2*5796c8dcSSimon Schubert    Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2007, 2008, 2009
3*5796c8dcSSimon Schubert    Free Software Foundation, Inc.
4*5796c8dcSSimon Schubert    Contributed by Cygnus Support.  Written by John Gilmore.
5*5796c8dcSSimon Schubert 
6*5796c8dcSSimon Schubert    This file is part of GDB.
7*5796c8dcSSimon Schubert 
8*5796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
9*5796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
10*5796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
11*5796c8dcSSimon Schubert    (at your option) any later version.
12*5796c8dcSSimon Schubert 
13*5796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
14*5796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*5796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*5796c8dcSSimon Schubert    GNU General Public License for more details.
17*5796c8dcSSimon Schubert 
18*5796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
19*5796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20*5796c8dcSSimon Schubert 
21*5796c8dcSSimon Schubert /* This file exists to hold the common definitions required of most of
22*5796c8dcSSimon Schubert    the symbol-readers that end up using stabs.  The common use of
23*5796c8dcSSimon Schubert    these `symbol-type-specific' customizations of the generic data
24*5796c8dcSSimon Schubert    structures makes the stabs-oriented symbol readers able to call
25*5796c8dcSSimon Schubert    each others' functions as required.  */
26*5796c8dcSSimon Schubert 
27*5796c8dcSSimon Schubert #if !defined (GDBSTABS_H)
28*5796c8dcSSimon Schubert #define GDBSTABS_H
29*5796c8dcSSimon Schubert 
30*5796c8dcSSimon Schubert /* The stab_section_info chain remembers info from the ELF symbol table,
31*5796c8dcSSimon Schubert    while psymtabs are being built for the other symbol tables in the
32*5796c8dcSSimon Schubert    objfile.  It is destroyed at the complation of psymtab-reading.
33*5796c8dcSSimon Schubert    Any info that was used from it has been copied into psymtabs.  */
34*5796c8dcSSimon Schubert 
35*5796c8dcSSimon Schubert struct stab_section_info
36*5796c8dcSSimon Schubert   {
37*5796c8dcSSimon Schubert     char *filename;
38*5796c8dcSSimon Schubert     struct stab_section_info *next;
39*5796c8dcSSimon Schubert     int found;			/* Count of times it's found in searching */
40*5796c8dcSSimon Schubert     size_t num_sections;
41*5796c8dcSSimon Schubert     CORE_ADDR sections[1];
42*5796c8dcSSimon Schubert   };
43*5796c8dcSSimon Schubert 
44*5796c8dcSSimon Schubert /* Information is passed among various dbxread routines for accessing
45*5796c8dcSSimon Schubert    symbol files.  A pointer to this structure is kept in the
46*5796c8dcSSimon Schubert    deprecated_sym_stab_info field of the objfile struct.  */
47*5796c8dcSSimon Schubert 
48*5796c8dcSSimon Schubert struct dbx_symfile_info
49*5796c8dcSSimon Schubert   {
50*5796c8dcSSimon Schubert     CORE_ADDR text_addr;	/* Start of text section */
51*5796c8dcSSimon Schubert     int text_size;		/* Size of text section */
52*5796c8dcSSimon Schubert     int symcount;		/* How many symbols are there in the file */
53*5796c8dcSSimon Schubert     char *stringtab;		/* The actual string table */
54*5796c8dcSSimon Schubert     int stringtab_size;		/* Its size */
55*5796c8dcSSimon Schubert     file_ptr symtab_offset;	/* Offset in file to symbol table */
56*5796c8dcSSimon Schubert     int symbol_size;		/* Bytes in a single symbol */
57*5796c8dcSSimon Schubert     struct stab_section_info *stab_section_info;	/* section starting points
58*5796c8dcSSimon Schubert 							   of the original .o files before linking. */
59*5796c8dcSSimon Schubert 
60*5796c8dcSSimon Schubert     /* See stabsread.h for the use of the following. */
61*5796c8dcSSimon Schubert     struct header_file *header_files;
62*5796c8dcSSimon Schubert     int n_header_files;
63*5796c8dcSSimon Schubert     int n_allocated_header_files;
64*5796c8dcSSimon Schubert 
65*5796c8dcSSimon Schubert     /* Pointers to BFD sections.  These are used to speed up the building of
66*5796c8dcSSimon Schubert        minimal symbols.  */
67*5796c8dcSSimon Schubert     asection *text_section;
68*5796c8dcSSimon Schubert     asection *data_section;
69*5796c8dcSSimon Schubert     asection *bss_section;
70*5796c8dcSSimon Schubert 
71*5796c8dcSSimon Schubert     /* Pointer to the separate ".stab" section, if there is one.  */
72*5796c8dcSSimon Schubert     asection *stab_section;
73*5796c8dcSSimon Schubert   };
74*5796c8dcSSimon Schubert 
75*5796c8dcSSimon Schubert #define DBX_SYMFILE_INFO(o)	((o)->deprecated_sym_stab_info)
76*5796c8dcSSimon Schubert #define DBX_TEXT_ADDR(o)	(DBX_SYMFILE_INFO(o)->text_addr)
77*5796c8dcSSimon Schubert #define DBX_TEXT_SIZE(o)	(DBX_SYMFILE_INFO(o)->text_size)
78*5796c8dcSSimon Schubert #define DBX_SYMCOUNT(o)		(DBX_SYMFILE_INFO(o)->symcount)
79*5796c8dcSSimon Schubert #define DBX_STRINGTAB(o)	(DBX_SYMFILE_INFO(o)->stringtab)
80*5796c8dcSSimon Schubert #define DBX_STRINGTAB_SIZE(o)	(DBX_SYMFILE_INFO(o)->stringtab_size)
81*5796c8dcSSimon Schubert #define DBX_SYMTAB_OFFSET(o)	(DBX_SYMFILE_INFO(o)->symtab_offset)
82*5796c8dcSSimon Schubert #define DBX_SYMBOL_SIZE(o)	(DBX_SYMFILE_INFO(o)->symbol_size)
83*5796c8dcSSimon Schubert #define DBX_TEXT_SECTION(o)	(DBX_SYMFILE_INFO(o)->text_section)
84*5796c8dcSSimon Schubert #define DBX_DATA_SECTION(o)	(DBX_SYMFILE_INFO(o)->data_section)
85*5796c8dcSSimon Schubert #define DBX_BSS_SECTION(o)	(DBX_SYMFILE_INFO(o)->bss_section)
86*5796c8dcSSimon Schubert #define DBX_STAB_SECTION(o)	(DBX_SYMFILE_INFO(o)->stab_section)
87*5796c8dcSSimon Schubert 
88*5796c8dcSSimon Schubert #endif /* GDBSTABS_H */
89