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