gdb-stabs.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Definitions for symbol-reading containing "stabs", for GDB.
  2. Copyright (C) 1992-2022 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. #ifndef GDB_STABS_H
  16. #define GDB_STABS_H
  17. /* This file exists to hold the common definitions required of most of
  18. the symbol-readers that end up using stabs. The common use of
  19. these `symbol-type-specific' customizations of the generic data
  20. structures makes the stabs-oriented symbol readers able to call
  21. each others' functions as required. */
  22. /* Information is passed among various dbxread routines for accessing
  23. symbol files. A pointer to this structure is kept in the objfile,
  24. using the dbx_objfile_data_key. */
  25. struct dbx_symfile_info
  26. {
  27. ~dbx_symfile_info ();
  28. CORE_ADDR text_addr = 0; /* Start of text section */
  29. int text_size = 0; /* Size of text section */
  30. int symcount = 0; /* How many symbols are there in the file */
  31. char *stringtab = nullptr; /* The actual string table */
  32. int stringtab_size = 0; /* Its size */
  33. file_ptr symtab_offset = 0; /* Offset in file to symbol table */
  34. int symbol_size = 0; /* Bytes in a single symbol */
  35. /* See stabsread.h for the use of the following. */
  36. struct header_file *header_files = nullptr;
  37. int n_header_files = 0;
  38. int n_allocated_header_files = 0;
  39. /* Pointers to BFD sections. These are used to speed up the building of
  40. minimal symbols. */
  41. asection *text_section = nullptr;
  42. asection *data_section = nullptr;
  43. asection *bss_section = nullptr;
  44. /* Pointer to the separate ".stab" section, if there is one. */
  45. asection *stab_section = nullptr;
  46. };
  47. /* The tag used to find the DBX info attached to an objfile. This is
  48. global because it is referenced by several modules. */
  49. extern objfile_key<dbx_symfile_info> dbx_objfile_data_key;
  50. #define DBX_SYMFILE_INFO(o) (dbx_objfile_data_key.get (o))
  51. #define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO(o)->text_addr)
  52. #define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO(o)->text_size)
  53. #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount)
  54. #define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab)
  55. #define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size)
  56. #define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset)
  57. #define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size)
  58. #define DBX_TEXT_SECTION(o) (DBX_SYMFILE_INFO(o)->text_section)
  59. #define DBX_DATA_SECTION(o) (DBX_SYMFILE_INFO(o)->data_section)
  60. #define DBX_BSS_SECTION(o) (DBX_SYMFILE_INFO(o)->bss_section)
  61. #define DBX_STAB_SECTION(o) (DBX_SYMFILE_INFO(o)->stab_section)
  62. #endif /* GDB_STABS_H */