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., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* This file exists to hold the common definitions required of all the
22 symbol-readers that end up using stabs. The common use of these
23 `symbol-type-specific' customizations of the generic data structures
24 makes the stabs-oriented symbol readers able to call each others'
25 functions as required. */
27 #if !defined (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 {
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_private
55 field of the objfile struct. */
57 struct dbx_symfile_info {
58 asection *text_sect; /* Text section accessor */
59 int symcount; /* How many symbols are there in the file */
60 char *stringtab; /* The actual string table */
61 int stringtab_size; /* Its size */
62 off_t symtab_offset; /* Offset in file to symbol table */
63 int symbol_size; /* Bytes in a single symbol */
64 struct stab_section_info *stab_section_info; /* section starting points
65 of the original .o files before linking. */
66 /* FIXME: HP kludges that shouldn't be here, probably. */
69 int hp_stringtab_size;
70 off_t hp_symtab_offset;
73 #define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_private))
74 #define DBX_TEXT_SECT(o) (DBX_SYMFILE_INFO(o)->text_sect)
75 #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount)
76 #define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab)
77 #define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size)
78 #define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset)
79 #define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size)
80 /* We don't use a macro for stab_section_info. */
81 #define HP_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->hp_symcount)
82 #define HP_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->hp_stringtab)
83 #define HP_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->hp_stringtab_size)
84 #define HP_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->hp_symtab_offset)
86 #endif /* GDBSTABS_H */