160484Sobrien/* dwarf2dbg.h - DWARF2 debug support
2218822Sdim   Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
360484Sobrien
460484Sobrien   This file is part of GAS, the GNU Assembler.
560484Sobrien
660484Sobrien   GAS is free software; you can redistribute it and/or modify
760484Sobrien   it under the terms of the GNU General Public License as published by
860484Sobrien   the Free Software Foundation; either version 2, or (at your option)
960484Sobrien   any later version.
1060484Sobrien
1160484Sobrien   GAS is distributed in the hope that it will be useful,
1260484Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1360484Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1460484Sobrien   GNU General Public License for more details.
1560484Sobrien
1660484Sobrien   You should have received a copy of the GNU General Public License
1760484Sobrien   along with GAS; see the file COPYING.  If not, write to the Free
18218822Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19218822Sdim   02110-1301, USA.  */
2060484Sobrien
2160484Sobrien#ifndef AS_DWARF2DBG_H
2260484Sobrien#define AS_DWARF2DBG_H
2360484Sobrien
2460484Sobrien#include "as.h"
2560484Sobrien
26218822Sdim#define DWARF2_FLAG_IS_STMT		(1 << 0)
27218822Sdim#define DWARF2_FLAG_BASIC_BLOCK		(1 << 1)
28218822Sdim#define DWARF2_FLAG_PROLOGUE_END	(1 << 2)
29218822Sdim#define DWARF2_FLAG_EPILOGUE_BEGIN	(1 << 3)
3060484Sobrien
3177298Sobrienstruct dwarf2_line_info {
3277298Sobrien  unsigned int filenum;
3377298Sobrien  unsigned int line;
3477298Sobrien  unsigned int column;
35218822Sdim  unsigned int isa;
3677298Sobrien  unsigned int flags;
3777298Sobrien};
3860484Sobrien
3960484Sobrien/* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
4060484Sobrien   to indicate that no file number has been assigned.  All real file
4160484Sobrien   number must be >0.  */
42130561Sobrienextern char *dwarf2_directive_file (int dummy);
4360484Sobrien
4460484Sobrien/* Implements the .loc FILENO LINENO [COLUMN] directive.  FILENO is
4560484Sobrien   the file number, LINENO the line number and the (optional) COLUMN
4660484Sobrien   the column of the source code that the following instruction
4760484Sobrien   corresponds to.  FILENO can be 0 to indicate that the filename
4860484Sobrien   specified by the textually most recent .file directive should be
4960484Sobrien   used.  */
50130561Sobrienextern void dwarf2_directive_loc (int dummy);
5160484Sobrien
52218822Sdim/* Implements the .loc_mark_labels {0,1} directive.  */
53218822Sdimextern void dwarf2_directive_loc_mark_labels (int dummy);
54218822Sdim
5560484Sobrien/* Returns the current source information.  If .file directives have
5660484Sobrien   been encountered, the info for the corresponding source file is
5760484Sobrien   returned.  Otherwise, the info for the assembly source file is
5860484Sobrien   returned.  */
59130561Sobrienextern void dwarf2_where (struct dwarf2_line_info *l);
6060484Sobrien
61218822Sdim/* A hook to allow the target backend to inform the line number state
62218822Sdim   machine of isa changes when assembler debug info is enabled.  */
63218822Sdimextern void dwarf2_set_isa (unsigned int isa);
64218822Sdim
6560484Sobrien/* This function generates .debug_line info based on the address and
6660484Sobrien   source information passed in the arguments.  ADDR should be the
6760484Sobrien   frag-relative offset of the instruction the information is for and
6860484Sobrien   L is the source information that should be associated with that
6977298Sobrien   address.  */
70130561Sobrienextern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l);
7160484Sobrien
7277298Sobrien/* Must be called for each generated instruction.  */
73130561Sobrienextern void dwarf2_emit_insn (int);
7477298Sobrien
75218822Sdim/* Should be called for each code label.  */
76218822Sdimextern void dwarf2_emit_label (symbolS *);
77218822Sdim
78218822Sdim/* True when we're supposed to set the basic block mark whenever a label
79218822Sdim   is seen.  Unless the target is doing Something Weird, just call
80218822Sdim   dwarf2_emit_label.  */
81359755Skevansextern bfd_boolean dwarf2_loc_mark_labels;
82218822Sdim
83130561Sobrienextern void dwarf2_finish (void);
8460484Sobrien
85130561Sobrienextern int dwarf2dbg_estimate_size_before_relax (fragS *);
86130561Sobrienextern int dwarf2dbg_relax_frag (fragS *);
87130561Sobrienextern void dwarf2dbg_convert_frag (fragS *);
8877298Sobrien
89130561Sobrien/* An enumeration which describes the sizes of offsets (to DWARF sections)
90130561Sobrien   and the mechanism by which the size is indicated.  */
91130561Sobrienenum dwarf2_format {
92130561Sobrien  /* 32-bit format: the initial length field is 4 bytes long.  */
93130561Sobrien  dwarf2_format_32bit,
94130561Sobrien  /* DWARF3 64-bit format: the representation of the initial length
95130561Sobrien     (of a DWARF section) is 0xffffffff (4 bytes) followed by eight
96130561Sobrien     bytes indicating the actual length.  */
97130561Sobrien  dwarf2_format_64bit,
98130561Sobrien  /* SGI extension to DWARF2: The initial length is eight bytes.  */
99130561Sobrien  dwarf2_format_64bit_irix
100130561Sobrien};
101130561Sobrien
10260484Sobrien#endif /* AS_DWARF2DBG_H */
103