xref: /dflybsd-src/contrib/binutils-2.27/gas/dwarf2dbg.h (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj /* dwarf2dbg.h - DWARF2 debug support
2*a9fa9459Szrj    Copyright (C) 1999-2016 Free Software Foundation, Inc.
3*a9fa9459Szrj 
4*a9fa9459Szrj    This file is part of GAS, the GNU Assembler.
5*a9fa9459Szrj 
6*a9fa9459Szrj    GAS is free software; you can redistribute it and/or modify
7*a9fa9459Szrj    it under the terms of the GNU General Public License as published by
8*a9fa9459Szrj    the Free Software Foundation; either version 3, or (at your option)
9*a9fa9459Szrj    any later version.
10*a9fa9459Szrj 
11*a9fa9459Szrj    GAS is distributed in the hope that it will be useful,
12*a9fa9459Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*a9fa9459Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*a9fa9459Szrj    GNU General Public License for more details.
15*a9fa9459Szrj 
16*a9fa9459Szrj    You should have received a copy of the GNU General Public License
17*a9fa9459Szrj    along with GAS; see the file COPYING.  If not, write to the Free
18*a9fa9459Szrj    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19*a9fa9459Szrj    02110-1301, USA.  */
20*a9fa9459Szrj 
21*a9fa9459Szrj #ifndef AS_DWARF2DBG_H
22*a9fa9459Szrj #define AS_DWARF2DBG_H
23*a9fa9459Szrj 
24*a9fa9459Szrj #include "as.h"
25*a9fa9459Szrj 
26*a9fa9459Szrj #define DWARF2_FLAG_IS_STMT		(1 << 0)
27*a9fa9459Szrj #define DWARF2_FLAG_BASIC_BLOCK		(1 << 1)
28*a9fa9459Szrj #define DWARF2_FLAG_PROLOGUE_END	(1 << 2)
29*a9fa9459Szrj #define DWARF2_FLAG_EPILOGUE_BEGIN	(1 << 3)
30*a9fa9459Szrj 
31*a9fa9459Szrj struct dwarf2_line_info {
32*a9fa9459Szrj   unsigned int filenum;
33*a9fa9459Szrj   unsigned int line;
34*a9fa9459Szrj   unsigned int column;
35*a9fa9459Szrj   unsigned int isa;
36*a9fa9459Szrj   unsigned int flags;
37*a9fa9459Szrj   unsigned int discriminator;
38*a9fa9459Szrj };
39*a9fa9459Szrj 
40*a9fa9459Szrj /* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
41*a9fa9459Szrj    to indicate that no file number has been assigned.  All real file
42*a9fa9459Szrj    number must be >0.  */
43*a9fa9459Szrj extern char *dwarf2_directive_file (int dummy);
44*a9fa9459Szrj 
45*a9fa9459Szrj /* Implements the .loc FILENO LINENO [COLUMN] directive.  FILENO is
46*a9fa9459Szrj    the file number, LINENO the line number and the (optional) COLUMN
47*a9fa9459Szrj    the column of the source code that the following instruction
48*a9fa9459Szrj    corresponds to.  FILENO can be 0 to indicate that the filename
49*a9fa9459Szrj    specified by the textually most recent .file directive should be
50*a9fa9459Szrj    used.  */
51*a9fa9459Szrj extern void dwarf2_directive_loc (int dummy);
52*a9fa9459Szrj 
53*a9fa9459Szrj /* Implements the .loc_mark_labels {0,1} directive.  */
54*a9fa9459Szrj extern void dwarf2_directive_loc_mark_labels (int dummy);
55*a9fa9459Szrj 
56*a9fa9459Szrj /* Returns the current source information.  If .file directives have
57*a9fa9459Szrj    been encountered, the info for the corresponding source file is
58*a9fa9459Szrj    returned.  Otherwise, the info for the assembly source file is
59*a9fa9459Szrj    returned.  */
60*a9fa9459Szrj extern void dwarf2_where (struct dwarf2_line_info *l);
61*a9fa9459Szrj 
62*a9fa9459Szrj /* A hook to allow the target backend to inform the line number state
63*a9fa9459Szrj    machine of isa changes when assembler debug info is enabled.  */
64*a9fa9459Szrj extern void dwarf2_set_isa (unsigned int isa);
65*a9fa9459Szrj 
66*a9fa9459Szrj /* This function generates .debug_line info based on the address and
67*a9fa9459Szrj    source information passed in the arguments.  ADDR should be the
68*a9fa9459Szrj    frag-relative offset of the instruction the information is for and
69*a9fa9459Szrj    L is the source information that should be associated with that
70*a9fa9459Szrj    address.  */
71*a9fa9459Szrj extern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l);
72*a9fa9459Szrj 
73*a9fa9459Szrj /* Must be called for each generated instruction.  */
74*a9fa9459Szrj extern void dwarf2_emit_insn (int);
75*a9fa9459Szrj 
76*a9fa9459Szrj void dwarf2_move_insn (int);
77*a9fa9459Szrj 
78*a9fa9459Szrj /* Reset the state of the line number information to reflect that
79*a9fa9459Szrj    it has been used.  */
80*a9fa9459Szrj extern void dwarf2_consume_line_info (void);
81*a9fa9459Szrj 
82*a9fa9459Szrj /* Should be called for each code label.  */
83*a9fa9459Szrj extern void dwarf2_emit_label (symbolS *);
84*a9fa9459Szrj 
85*a9fa9459Szrj /* True when we've seen a .loc directive recently.  Used to avoid
86*a9fa9459Szrj    doing work when there's nothing to do.  */
87*a9fa9459Szrj extern bfd_boolean dwarf2_loc_directive_seen;
88*a9fa9459Szrj 
89*a9fa9459Szrj /* True when we're supposed to set the basic block mark whenever a label
90*a9fa9459Szrj    is seen.  Unless the target is doing Something Weird, just call
91*a9fa9459Szrj    dwarf2_emit_label.  */
92*a9fa9459Szrj extern bfd_boolean dwarf2_loc_mark_labels;
93*a9fa9459Szrj 
94*a9fa9459Szrj extern void dwarf2_init (void);
95*a9fa9459Szrj 
96*a9fa9459Szrj extern void dwarf2_finish (void);
97*a9fa9459Szrj 
98*a9fa9459Szrj extern int dwarf2dbg_estimate_size_before_relax (fragS *);
99*a9fa9459Szrj extern int dwarf2dbg_relax_frag (fragS *);
100*a9fa9459Szrj extern void dwarf2dbg_convert_frag (fragS *);
101*a9fa9459Szrj 
102*a9fa9459Szrj /* An enumeration which describes the sizes of offsets (to DWARF sections)
103*a9fa9459Szrj    and the mechanism by which the size is indicated.  */
104*a9fa9459Szrj enum dwarf2_format {
105*a9fa9459Szrj   /* 32-bit format: the initial length field is 4 bytes long.  */
106*a9fa9459Szrj   dwarf2_format_32bit,
107*a9fa9459Szrj   /* DWARF3 64-bit format: the representation of the initial length
108*a9fa9459Szrj      (of a DWARF section) is 0xffffffff (4 bytes) followed by eight
109*a9fa9459Szrj      bytes indicating the actual length.  */
110*a9fa9459Szrj   dwarf2_format_64bit,
111*a9fa9459Szrj   /* SGI extension to DWARF2: The initial length is eight bytes.  */
112*a9fa9459Szrj   dwarf2_format_64bit_irix
113*a9fa9459Szrj };
114*a9fa9459Szrj 
115*a9fa9459Szrj #endif /* AS_DWARF2DBG_H */
116