1 /* Definitions for symbol-reading containing "stabs", for GDB.
2 Copyright 1992 Free Software Foundation, Inc.
3 Contributed by Cygnus Support. Written by John Gilmore.
5 This file is part of GDB.
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This file exists to hold the common definitions required of most of
23 the symbol-readers that end up using stabs. The common use of
24 these `symbol-type-specific' customizations of the generic data
25 structures makes the stabs-oriented symbol readers able to call
26 each others' functions as required. */
28 #if !defined (GDBSTABS_H)
31 /* Offsets in the psymtab's section_offsets array for various kinds of
32 stabs symbols. Every psymtab built from stabs will have these offsets
33 filled in by these guidelines, so that when actually reading symbols, the
34 proper offset can simply be selected and added to the symbol value. */
36 #define SECT_OFF_TEXT 0
37 #define SECT_OFF_DATA 1
38 #define SECT_OFF_BSS 2
39 #define SECT_OFF_RODATA 3
40 #define SECT_OFF_MAX 4 /* Count of possible values */
42 /* The stab_section_info chain remembers info from the ELF symbol table,
43 while psymtabs are being built for the other symbol tables in the
44 objfile. It is destroyed at the complation of psymtab-reading.
45 Any info that was used from it has been copied into psymtabs. */
47 struct stab_section_info
50 CORE_ADDR sections[SECT_OFF_MAX];
51 struct stab_section_info *next;
52 int found; /* Count of times it's found in searching */
55 /* Information is passed among various dbxread routines for accessing
56 symbol files. A pointer to this structure is kept in the sym_stab_info
57 field of the objfile struct. */
59 struct dbx_symfile_info
61 CORE_ADDR text_addr; /* Start of text section */
62 int text_size; /* Size of text section */
63 int symcount; /* How many symbols are there in the file */
64 char *stringtab; /* The actual string table */
65 int stringtab_size; /* Its size */
66 file_ptr symtab_offset; /* Offset in file to symbol table */
67 int symbol_size; /* Bytes in a single symbol */
68 struct stab_section_info *stab_section_info; /* section starting points
69 of the original .o files before linking. */
71 /* See stabsread.h for the use of the following. */
72 struct header_file *header_files;
74 int n_allocated_header_files;
76 /* Pointers to BFD sections. These are used to speed up the building of
78 asection *text_section;
79 asection *data_section;
80 asection *bss_section;
83 #define DBX_SYMFILE_INFO(o) ((o)->sym_stab_info)
84 #define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO(o)->text_addr)
85 #define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO(o)->text_size)
86 #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount)
87 #define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab)
88 #define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size)
89 #define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset)
90 #define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size)
91 #define DBX_TEXT_SECTION(o) (DBX_SYMFILE_INFO(o)->text_section)
92 #define DBX_DATA_SECTION(o) (DBX_SYMFILE_INFO(o)->data_section)
93 #define DBX_BSS_SECTION(o) (DBX_SYMFILE_INFO(o)->bss_section)
95 #endif /* GDBSTABS_H */