| 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. |
| 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 2 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, write to the Free Software |
| 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 20 | |
| 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. */ |
| 26 | |
| 27 | #if !defined (GDBSTABS_H) |
| 28 | #define GDBSTABS_H |
| 29 | |
| 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. */ |
| 34 | |
| 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 */ |
| 40 | |
| 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. */ |
| 45 | |
| 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 */ |
| 51 | }; |
| 52 | |
| 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. */ |
| 56 | |
| 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 | file_ptr 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 | }; |
| 67 | |
| 68 | #define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_private)) |
| 69 | #define DBX_TEXT_SECT(o) (DBX_SYMFILE_INFO(o)->text_sect) |
| 70 | #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount) |
| 71 | #define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab) |
| 72 | #define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size) |
| 73 | #define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset) |
| 74 | #define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size) |
| 75 | |
| 76 | #endif /* GDBSTABS_H */ |