buildsym-legacy.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Build symbol tables in GDB's internal format - legacy APIs
  2. Copyright (C) 1986-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef BUILDSYM_LEGACY_H
  15. #define BUILDSYM_LEGACY_H
  16. #include "buildsym.h"
  17. /* This module provides definitions used for creating and adding to
  18. the symbol table. These routines are called from various symbol-
  19. file-reading routines. This file holds the legacy API, which
  20. relies on a global variable to work properly. New or maintained
  21. symbol readers should use the builder API in buildsym.h.
  22. The basic way this module is used is as follows:
  23. scoped_free_pendings free_pending;
  24. cust = start_compunit_symtab (...);
  25. ... read debug info ...
  26. cust = end_compunit_symtab (...);
  27. The compunit symtab pointer ("cust") is returned from both
  28. start_compunit_symtab and end_compunit_symtab to simplify the debug info readers.
  29. dbxread.c and xcoffread.c use another variation:
  30. scoped_free_pendings free_pending;
  31. cust = start_compunit_symtab (...);
  32. ... read debug info ...
  33. cust = end_compunit_symtab (...);
  34. ... start_compunit_symtab + read + end_compunit_symtab repeated ...
  35. */
  36. class scoped_free_pendings
  37. {
  38. public:
  39. scoped_free_pendings () = default;
  40. ~scoped_free_pendings ();
  41. DISABLE_COPY_AND_ASSIGN (scoped_free_pendings);
  42. };
  43. extern struct block *finish_block (struct symbol *symbol,
  44. struct pending_block *old_blocks,
  45. const struct dynamic_prop *static_link,
  46. CORE_ADDR start,
  47. CORE_ADDR end);
  48. extern void start_subfile (const char *name);
  49. extern void patch_subfile_names (struct subfile *subfile, const char *name);
  50. extern void push_subfile ();
  51. extern const char *pop_subfile ();
  52. extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr,
  53. int section);
  54. extern struct context_stack *push_context (int desc, CORE_ADDR valu);
  55. extern struct context_stack pop_context ();
  56. extern void record_line (struct subfile *subfile, int line, CORE_ADDR pc);
  57. extern struct compunit_symtab *start_compunit_symtab (struct objfile *objfile,
  58. const char *name,
  59. const char *comp_dir,
  60. CORE_ADDR start_addr,
  61. enum language language);
  62. /* Record the name of the debug format in the current pending symbol
  63. table. FORMAT must be a string with a lifetime at least as long as
  64. the symtab's objfile. */
  65. extern void record_debugformat (const char *format);
  66. /* Record the name of the debuginfo producer (usually the compiler) in
  67. the current pending symbol table. PRODUCER must be a string with a
  68. lifetime at least as long as the symtab's objfile. */
  69. extern void record_producer (const char *producer);
  70. /* Set the name of the last source file. NAME is copied by this
  71. function. */
  72. extern void set_last_source_file (const char *name);
  73. /* Fetch the name of the last source file. */
  74. extern const char *get_last_source_file (void);
  75. /* Set the last source start address. Can only be used between
  76. start_compunit_symtab and end_compunit_symtab* calls. */
  77. extern void set_last_source_start_addr (CORE_ADDR addr);
  78. /* Get the last source start address. Can only be used between
  79. start_compunit_symtab and end_compunit_symtab* calls. */
  80. extern CORE_ADDR get_last_source_start_addr ();
  81. /* True if the context stack is empty. */
  82. extern bool outermost_context_p ();
  83. /* Return the context stack depth. */
  84. extern int get_context_stack_depth ();
  85. /* Return the current subfile. */
  86. extern struct subfile *get_current_subfile ();
  87. /* Return the local symbol list. */
  88. extern struct pending **get_local_symbols ();
  89. /* Return the file symbol list. */
  90. extern struct pending **get_file_symbols ();
  91. /* Return the global symbol list. */
  92. extern struct pending **get_global_symbols ();
  93. /* Return the current buildsym_compunit. */
  94. extern struct buildsym_compunit *get_buildsym_compunit ();
  95. #endif /* BUILDSYM_LEGACY_H */