gdb/gdb-stabs.h - gdb

Data types defined

Macros defined

Source code

  1. /* Definitions for symbol-reading containing "stabs", for GDB.
  2.    Copyright (C) 1992-2015 Free Software Foundation, Inc.
  3.    Contributed by Cygnus Support.  Written by John Gilmore.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. /* This file exists to hold the common definitions required of most of
  16.    the symbol-readers that end up using stabs.  The common use of
  17.    these `symbol-type-specific' customizations of the generic data
  18.    structures makes the stabs-oriented symbol readers able to call
  19.    each others' functions as required.  */

  20. #if !defined (GDBSTABS_H)
  21. #define GDBSTABS_H

  22. /* The tag used to find the DBX info attached to an objfile.  This is
  23.    global because it is referenced by several modules.  */
  24. extern const struct objfile_data *dbx_objfile_data_key;

  25. /* The stab_section_info chain remembers info from the ELF symbol table,
  26.    while psymtabs are being built for the other symbol tables in the
  27.    objfile.  It is destroyed at the complation of psymtab-reading.
  28.    Any info that was used from it has been copied into psymtabs.  */

  29. struct stab_section_info
  30.   {
  31.     char *filename;
  32.     struct stab_section_info *next;
  33.     int found;                        /* Count of times it's found in searching.  */
  34.     size_t num_sections;
  35.     CORE_ADDR sections[1];
  36.   };

  37. /* Information is passed among various dbxread routines for accessing
  38.    symbol files.  A pointer to this structure is kept in the objfile,
  39.    using the dbx_objfile_data_key.  */

  40. struct dbx_symfile_info
  41.   {
  42.     CORE_ADDR text_addr;        /* Start of text section */
  43.     int text_size;                /* Size of text section */
  44.     int symcount;                /* How many symbols are there in the file */
  45.     char *stringtab;                /* The actual string table */
  46.     int stringtab_size;                /* Its size */
  47.     file_ptr symtab_offset;        /* Offset in file to symbol table */
  48.     int symbol_size;                /* Bytes in a single symbol */
  49.     struct stab_section_info *stab_section_info;    /* Section starting points
  50.                                                        of the original .o files
  51.                                                        before linking.  */

  52.     /* See stabsread.h for the use of the following.  */
  53.     struct header_file *header_files;
  54.     int n_header_files;
  55.     int n_allocated_header_files;

  56.     /* Pointers to BFD sections.  These are used to speed up the building of
  57.        minimal symbols.  */
  58.     asection *text_section;
  59.     asection *data_section;
  60.     asection *bss_section;

  61.     /* Pointer to the separate ".stab" section, if there is one.  */
  62.     asection *stab_section;
  63.   };

  64. #define DBX_SYMFILE_INFO(o) \
  65.   ((struct dbx_symfile_info *) objfile_data ((o), dbx_objfile_data_key))
  66. #define DBX_TEXT_ADDR(o)        (DBX_SYMFILE_INFO(o)->text_addr)
  67. #define DBX_TEXT_SIZE(o)        (DBX_SYMFILE_INFO(o)->text_size)
  68. #define DBX_SYMCOUNT(o)                (DBX_SYMFILE_INFO(o)->symcount)
  69. #define DBX_STRINGTAB(o)        (DBX_SYMFILE_INFO(o)->stringtab)
  70. #define DBX_STRINGTAB_SIZE(o)        (DBX_SYMFILE_INFO(o)->stringtab_size)
  71. #define DBX_SYMTAB_OFFSET(o)        (DBX_SYMFILE_INFO(o)->symtab_offset)
  72. #define DBX_SYMBOL_SIZE(o)        (DBX_SYMFILE_INFO(o)->symbol_size)
  73. #define DBX_TEXT_SECTION(o)        (DBX_SYMFILE_INFO(o)->text_section)
  74. #define DBX_DATA_SECTION(o)        (DBX_SYMFILE_INFO(o)->data_section)
  75. #define DBX_BSS_SECTION(o)        (DBX_SYMFILE_INFO(o)->bss_section)
  76. #define DBX_STAB_SECTION(o)        (DBX_SYMFILE_INFO(o)->stab_section)

  77. #endif /* GDBSTABS_H */