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