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