* Fix for PR 18665, from sky branch.
[binutils-gdb.git] / gdb / gdb-stabs.h
blob1ad782abdcae30aa055f0c1b9c5c2335dfc3a39b
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, Boston, MA 02111-1307, USA. */
21 /* This file exists to hold the common definitions required of most of
22 the symbol-readers that end up using stabs. The common use of
23 these `symbol-type-specific' customizations of the generic data
24 structures makes the stabs-oriented symbol readers able to call
25 each others' functions as required. */
27 #if !defined (GDBSTABS_H)
28 #define GDBSTABS_H
30 /* Offsets in the psymtab's section_offsets array for various kinds of
31 stabs symbols. Every psymtab built from stabs will have these offsets
32 filled in by these guidelines, so that when actually reading symbols, the
33 proper offset can simply be selected and added to the symbol value. */
35 #define SECT_OFF_TEXT 0
36 #define SECT_OFF_DATA 1
37 #define SECT_OFF_BSS 2
38 #define SECT_OFF_RODATA 3
39 #define SECT_OFF_MAX 4 /* Count of possible values */
41 /* The stab_section_info chain remembers info from the ELF symbol table,
42 while psymtabs are being built for the other symbol tables in the
43 objfile. It is destroyed at the complation of psymtab-reading.
44 Any info that was used from it has been copied into psymtabs. */
46 struct stab_section_info {
47 char *filename;
48 CORE_ADDR sections[SECT_OFF_MAX];
49 struct stab_section_info *next;
50 int found; /* Count of times it's found in searching */
53 /* Information is passed among various dbxread routines for accessing
54 symbol files. A pointer to this structure is kept in the sym_stab_info
55 field of the objfile struct. */
57 struct dbx_symfile_info {
58 CORE_ADDR text_addr; /* Start of text section */
59 int text_size; /* Size of text section */
60 int symcount; /* How many symbols are there in the file */
61 char *stringtab; /* The actual string table */
62 int stringtab_size; /* Its size */
63 file_ptr symtab_offset; /* Offset in file to symbol table */
64 int symbol_size; /* Bytes in a single symbol */
65 struct stab_section_info *stab_section_info; /* section starting points
66 of the original .o files before linking. */
68 /* See stabsread.h for the use of the following. */
69 struct header_file *header_files;
70 int n_header_files;
71 int n_allocated_header_files;
73 /* Pointers to BFD sections. These are used to speed up the building of
74 minimal symbols. */
75 asection *text_section;
76 asection *data_section;
77 asection *bss_section;
80 #define DBX_SYMFILE_INFO(o) ((o)->sym_stab_info)
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)
92 #endif /* GDBSTABS_H */