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