dwarf2dbg.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* dwarf2dbg.h - DWARF2 debug support
  2. Copyright (C) 1999-2022 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS 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, or (at your option)
  7. any later version.
  8. GAS 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 GAS; see the file COPYING. If not, write to the Free
  14. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  15. 02110-1301, USA. */
  16. #ifndef AS_DWARF2DBG_H
  17. #define AS_DWARF2DBG_H
  18. #include "as.h"
  19. #define DWARF2_FLAG_IS_STMT (1 << 0)
  20. #define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
  21. #define DWARF2_FLAG_PROLOGUE_END (1 << 2)
  22. #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
  23. struct dwarf2_line_info
  24. {
  25. unsigned int filenum;
  26. unsigned int line;
  27. unsigned int column;
  28. unsigned int isa;
  29. unsigned int flags;
  30. unsigned int discriminator;
  31. /* filenum == -1u chooses filename, otherwise view. */
  32. union
  33. {
  34. symbolS *view;
  35. const char *filename;
  36. } u;
  37. };
  38. /* Implements the .file FILENO "FILENAME" directive. FILENO can be 0
  39. to indicate that no file number has been assigned. All real file
  40. number must be >0. The second form returns the filename extracted
  41. from the input stream. */
  42. extern void dwarf2_directive_file (int);
  43. extern char * dwarf2_directive_filename (void);
  44. /* Implements the .loc FILENO LINENO [COLUMN] directive. FILENO is
  45. the file number, LINENO the line number and the (optional) COLUMN
  46. the column of the source code that the following instruction
  47. corresponds to. FILENO can be 0 to indicate that the filename
  48. specified by the textually most recent .file directive should be
  49. used. */
  50. extern void dwarf2_directive_loc (int);
  51. /* Implements the .loc_mark_labels {0,1} directive. */
  52. extern void dwarf2_directive_loc_mark_labels (int);
  53. /* Returns the current source information. If .file directives have
  54. been encountered, the info for the corresponding source file is
  55. returned. Otherwise, the info for the assembly source file is
  56. returned. */
  57. extern void dwarf2_where (struct dwarf2_line_info *);
  58. /* A hook to allow the target backend to inform the line number state
  59. machine of isa changes when assembler debug info is enabled. */
  60. extern void dwarf2_set_isa (unsigned int);
  61. /* This function generates .debug_line info based on the address and
  62. source information passed in the arguments. ADDR should be the
  63. frag-relative offset of the instruction the information is for and
  64. L is the source information that should be associated with that
  65. address. */
  66. extern void dwarf2_gen_line_info (addressT, struct dwarf2_line_info *);
  67. /* Must be called for each generated instruction. */
  68. extern void dwarf2_emit_insn (int);
  69. void dwarf2_move_insn (int);
  70. /* Reset the state of the line number information to reflect that
  71. it has been used. */
  72. extern void dwarf2_consume_line_info (void);
  73. /* Should be called for each code label. */
  74. extern void dwarf2_emit_label (symbolS *);
  75. /* True when we've seen a .loc directive recently. Used to avoid
  76. doing work when there's nothing to do. */
  77. extern bool dwarf2_loc_directive_seen;
  78. /* True when we're supposed to set the basic block mark whenever a label
  79. is seen. Unless the target is doing Something Weird, just call
  80. dwarf2_emit_label. */
  81. extern bool dwarf2_loc_mark_labels;
  82. extern void dwarf2_init (void);
  83. extern void dwarf2_finish (void);
  84. extern int dwarf2dbg_estimate_size_before_relax (fragS *);
  85. extern int dwarf2dbg_relax_frag (fragS *);
  86. extern void dwarf2dbg_convert_frag (fragS *);
  87. extern void dwarf2dbg_final_check (void);
  88. /* An enumeration which describes the sizes of offsets (to DWARF sections)
  89. and the mechanism by which the size is indicated. */
  90. enum dwarf2_format
  91. {
  92. /* 32-bit format: the initial length field is 4 bytes long. */
  93. dwarf2_format_32bit,
  94. /* DWARF3 64-bit format: the representation of the initial length
  95. (of a DWARF section) is 0xffffffff (4 bytes) followed by eight
  96. bytes indicating the actual length. */
  97. dwarf2_format_64bit,
  98. /* SGI extension to DWARF2: The initial length is eight bytes. */
  99. dwarf2_format_64bit_irix
  100. };
  101. #endif /* AS_DWARF2DBG_H */