dwarf2dbg.h revision 218822
1263239Sandrew/* dwarf2dbg.h - DWARF2 debug support
2263239Sandrew   Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3263239Sandrew
4263239Sandrew   This file is part of GAS, the GNU Assembler.
5263239Sandrew
6263239Sandrew   GAS is free software; you can redistribute it and/or modify
7263239Sandrew   it under the terms of the GNU General Public License as published by
8263239Sandrew   the Free Software Foundation; either version 2, or (at your option)
9263239Sandrew   any later version.
10263239Sandrew
11263239Sandrew   GAS is distributed in the hope that it will be useful,
12263239Sandrew   but WITHOUT ANY WARRANTY; without even the implied warranty of
13263239Sandrew   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14263239Sandrew   GNU General Public License for more details.
15263239Sandrew
16263239Sandrew   You should have received a copy of the GNU General Public License
17263239Sandrew   along with GAS; see the file COPYING.  If not, write to the Free
18263239Sandrew   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19263239Sandrew   02110-1301, USA.  */
20263239Sandrew
21263239Sandrew#ifndef AS_DWARF2DBG_H
22263239Sandrew#define AS_DWARF2DBG_H
23263239Sandrew
24263239Sandrew#include "as.h"
25263239Sandrew
26263239Sandrew#define DWARF2_FLAG_IS_STMT		(1 << 0)
27263239Sandrew#define DWARF2_FLAG_BASIC_BLOCK		(1 << 1)
28263239Sandrew#define DWARF2_FLAG_PROLOGUE_END	(1 << 2)
29263239Sandrew#define DWARF2_FLAG_EPILOGUE_BEGIN	(1 << 3)
30263239Sandrew
31263239Sandrewstruct dwarf2_line_info {
32263239Sandrew  unsigned int filenum;
33263239Sandrew  unsigned int line;
34263239Sandrew  unsigned int column;
35263239Sandrew  unsigned int isa;
36273088Sandrew  unsigned int flags;
37273088Sandrew};
38273088Sandrew
39273088Sandrew/* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
40273088Sandrew   to indicate that no file number has been assigned.  All real file
41273088Sandrew   number must be >0.  */
42273088Sandrewextern char *dwarf2_directive_file (int dummy);
43273088Sandrew
44273088Sandrew/* Implements the .loc FILENO LINENO [COLUMN] directive.  FILENO is
45273088Sandrew   the file number, LINENO the line number and the (optional) COLUMN
46273088Sandrew   the column of the source code that the following instruction
47273088Sandrew   corresponds to.  FILENO can be 0 to indicate that the filename
48273088Sandrew   specified by the textually most recent .file directive should be
49273088Sandrew   used.  */
50273088Sandrewextern void dwarf2_directive_loc (int dummy);
51273088Sandrew
52273088Sandrew/* Implements the .loc_mark_labels {0,1} directive.  */
53273088Sandrewextern void dwarf2_directive_loc_mark_labels (int dummy);
54273088Sandrew
55273088Sandrew/* Returns the current source information.  If .file directives have
56273088Sandrew   been encountered, the info for the corresponding source file is
57273088Sandrew   returned.  Otherwise, the info for the assembly source file is
58273088Sandrew   returned.  */
59273088Sandrewextern void dwarf2_where (struct dwarf2_line_info *l);
60273088Sandrew
61273088Sandrew/* A hook to allow the target backend to inform the line number state
62273088Sandrew   machine of isa changes when assembler debug info is enabled.  */
63263239Sandrewextern void dwarf2_set_isa (unsigned int isa);
64263239Sandrew
65263239Sandrew/* This function generates .debug_line info based on the address and
66263239Sandrew   source information passed in the arguments.  ADDR should be the
67263239Sandrew   frag-relative offset of the instruction the information is for and
68263239Sandrew   L is the source information that should be associated with that
69282816Sandrew   address.  */
70263239Sandrewextern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l);
71263239Sandrew
72263239Sandrew/* Must be called for each generated instruction.  */
73263239Sandrewextern void dwarf2_emit_insn (int);
74263239Sandrew
75263239Sandrew/* Should be called for each code label.  */
76263239Sandrewextern void dwarf2_emit_label (symbolS *);
77263239Sandrew
78263239Sandrew/* True when we're supposed to set the basic block mark whenever a label
79263239Sandrew   is seen.  Unless the target is doing Something Weird, just call
80263239Sandrew   dwarf2_emit_label.  */
81282816Sandrewbfd_boolean dwarf2_loc_mark_labels;
82263239Sandrew
83282816Sandrewextern void dwarf2_finish (void);
84263239Sandrew
85263239Sandrewextern int dwarf2dbg_estimate_size_before_relax (fragS *);
86263239Sandrewextern int dwarf2dbg_relax_frag (fragS *);
87263239Sandrewextern void dwarf2dbg_convert_frag (fragS *);
88263239Sandrew
89263239Sandrew/* An enumeration which describes the sizes of offsets (to DWARF sections)
90263239Sandrew   and the mechanism by which the size is indicated.  */
91263239Sandrewenum dwarf2_format {
92263239Sandrew  /* 32-bit format: the initial length field is 4 bytes long.  */
93282816Sandrew  dwarf2_format_32bit,
94263239Sandrew  /* DWARF3 64-bit format: the representation of the initial length
95263239Sandrew     (of a DWARF section) is 0xffffffff (4 bytes) followed by eight
96263239Sandrew     bytes indicating the actual length.  */
97263239Sandrew  dwarf2_format_64bit,
98263239Sandrew  /* SGI extension to DWARF2: The initial length is eight bytes.  */
99263239Sandrew  dwarf2_format_64bit_irix
100263239Sandrew};
101263239Sandrew
102263239Sandrew#endif /* AS_DWARF2DBG_H */
103263239Sandrew