1a1ba9ba4Schristos /* Definitions for symbol-reading containing "stabs", for GDB.
2*184b2d41Schristos    Copyright (C) 1992-2020 Free Software Foundation, Inc.
3a1ba9ba4Schristos    Contributed by Cygnus Support.  Written by John Gilmore.
4a1ba9ba4Schristos 
5a1ba9ba4Schristos    This file is part of GDB.
6a1ba9ba4Schristos 
7a1ba9ba4Schristos    This program is free software; you can redistribute it and/or modify
8a1ba9ba4Schristos    it under the terms of the GNU General Public License as published by
9a1ba9ba4Schristos    the Free Software Foundation; either version 3 of the License, or
10a1ba9ba4Schristos    (at your option) any later version.
11a1ba9ba4Schristos 
12a1ba9ba4Schristos    This program is distributed in the hope that it will be useful,
13a1ba9ba4Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14a1ba9ba4Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15a1ba9ba4Schristos    GNU General Public License for more details.
16a1ba9ba4Schristos 
17a1ba9ba4Schristos    You should have received a copy of the GNU General Public License
18a1ba9ba4Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19a1ba9ba4Schristos 
20051580eeSchristos #ifndef GDB_STABS_H
21051580eeSchristos #define GDB_STABS_H
22051580eeSchristos 
23a1ba9ba4Schristos /* This file exists to hold the common definitions required of most of
24a1ba9ba4Schristos    the symbol-readers that end up using stabs.  The common use of
25a1ba9ba4Schristos    these `symbol-type-specific' customizations of the generic data
26a1ba9ba4Schristos    structures makes the stabs-oriented symbol readers able to call
27a1ba9ba4Schristos    each others' functions as required.  */
28a1ba9ba4Schristos 
29a1ba9ba4Schristos 
30a1ba9ba4Schristos /* Information is passed among various dbxread routines for accessing
31a1ba9ba4Schristos    symbol files.  A pointer to this structure is kept in the objfile,
32a1ba9ba4Schristos    using the dbx_objfile_data_key.  */
33a1ba9ba4Schristos 
34a1ba9ba4Schristos struct dbx_symfile_info
35a1ba9ba4Schristos   {
36*184b2d41Schristos     ~dbx_symfile_info ();
37*184b2d41Schristos 
38*184b2d41Schristos     CORE_ADDR text_addr = 0;	/* Start of text section */
39*184b2d41Schristos     int text_size = 0;		/* Size of text section */
40*184b2d41Schristos     int symcount = 0;		/* How many symbols are there in the file */
41*184b2d41Schristos     char *stringtab = nullptr;		/* The actual string table */
42*184b2d41Schristos     int stringtab_size = 0;		/* Its size */
43*184b2d41Schristos     file_ptr symtab_offset = 0;	/* Offset in file to symbol table */
44*184b2d41Schristos     int symbol_size = 0;		/* Bytes in a single symbol */
45a1ba9ba4Schristos 
46a1ba9ba4Schristos     /* See stabsread.h for the use of the following.  */
47*184b2d41Schristos     struct header_file *header_files = nullptr;
48*184b2d41Schristos     int n_header_files = 0;
49*184b2d41Schristos     int n_allocated_header_files = 0;
50a1ba9ba4Schristos 
51a1ba9ba4Schristos     /* Pointers to BFD sections.  These are used to speed up the building of
52a1ba9ba4Schristos        minimal symbols.  */
53*184b2d41Schristos     asection *text_section = nullptr;
54*184b2d41Schristos     asection *data_section = nullptr;
55*184b2d41Schristos     asection *bss_section = nullptr;
56a1ba9ba4Schristos 
57a1ba9ba4Schristos     /* Pointer to the separate ".stab" section, if there is one.  */
58*184b2d41Schristos     asection *stab_section = nullptr;
59a1ba9ba4Schristos   };
60a1ba9ba4Schristos 
61*184b2d41Schristos /* The tag used to find the DBX info attached to an objfile.  This is
62*184b2d41Schristos    global because it is referenced by several modules.  */
63*184b2d41Schristos extern objfile_key<dbx_symfile_info> dbx_objfile_data_key;
64*184b2d41Schristos 
65*184b2d41Schristos #define DBX_SYMFILE_INFO(o)	(dbx_objfile_data_key.get (o))
66a1ba9ba4Schristos #define DBX_TEXT_ADDR(o)	(DBX_SYMFILE_INFO(o)->text_addr)
67a1ba9ba4Schristos #define DBX_TEXT_SIZE(o)	(DBX_SYMFILE_INFO(o)->text_size)
68a1ba9ba4Schristos #define DBX_SYMCOUNT(o)		(DBX_SYMFILE_INFO(o)->symcount)
69a1ba9ba4Schristos #define DBX_STRINGTAB(o)	(DBX_SYMFILE_INFO(o)->stringtab)
70a1ba9ba4Schristos #define DBX_STRINGTAB_SIZE(o)	(DBX_SYMFILE_INFO(o)->stringtab_size)
71a1ba9ba4Schristos #define DBX_SYMTAB_OFFSET(o)	(DBX_SYMFILE_INFO(o)->symtab_offset)
72a1ba9ba4Schristos #define DBX_SYMBOL_SIZE(o)	(DBX_SYMFILE_INFO(o)->symbol_size)
73a1ba9ba4Schristos #define DBX_TEXT_SECTION(o)	(DBX_SYMFILE_INFO(o)->text_section)
74a1ba9ba4Schristos #define DBX_DATA_SECTION(o)	(DBX_SYMFILE_INFO(o)->data_section)
75a1ba9ba4Schristos #define DBX_BSS_SECTION(o)	(DBX_SYMFILE_INFO(o)->bss_section)
76a1ba9ba4Schristos #define DBX_STAB_SECTION(o)	(DBX_SYMFILE_INFO(o)->stab_section)
77a1ba9ba4Schristos 
78051580eeSchristos #endif /* GDB_STABS_H */
79