175fd0b74Schristos /* dwarf2dbg.h - DWARF2 debug support 2*e992f068Schristos Copyright (C) 1999-2022 Free Software Foundation, Inc. 375fd0b74Schristos 475fd0b74Schristos This file is part of GAS, the GNU Assembler. 575fd0b74Schristos 675fd0b74Schristos GAS is free software; you can redistribute it and/or modify 775fd0b74Schristos it under the terms of the GNU General Public License as published by 875fd0b74Schristos the Free Software Foundation; either version 3, or (at your option) 975fd0b74Schristos any later version. 1075fd0b74Schristos 1175fd0b74Schristos GAS is distributed in the hope that it will be useful, 1275fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1375fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1475fd0b74Schristos GNU General Public License for more details. 1575fd0b74Schristos 1675fd0b74Schristos You should have received a copy of the GNU General Public License 1775fd0b74Schristos along with GAS; see the file COPYING. If not, write to the Free 1875fd0b74Schristos Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 1975fd0b74Schristos 02110-1301, USA. */ 2075fd0b74Schristos 2175fd0b74Schristos #ifndef AS_DWARF2DBG_H 2275fd0b74Schristos #define AS_DWARF2DBG_H 2375fd0b74Schristos 2475fd0b74Schristos #include "as.h" 2575fd0b74Schristos 2675fd0b74Schristos #define DWARF2_FLAG_IS_STMT (1 << 0) 2775fd0b74Schristos #define DWARF2_FLAG_BASIC_BLOCK (1 << 1) 2875fd0b74Schristos #define DWARF2_FLAG_PROLOGUE_END (1 << 2) 2975fd0b74Schristos #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3) 3075fd0b74Schristos 31ede78133Schristos struct dwarf2_line_info 32ede78133Schristos { 3375fd0b74Schristos unsigned int filenum; 3475fd0b74Schristos unsigned int line; 3575fd0b74Schristos unsigned int column; 3675fd0b74Schristos unsigned int isa; 3775fd0b74Schristos unsigned int flags; 3875fd0b74Schristos unsigned int discriminator; 39*e992f068Schristos /* filenum == -1u chooses filename, otherwise view. */ 40*e992f068Schristos union 41*e992f068Schristos { 42ede78133Schristos symbolS *view; 43*e992f068Schristos const char *filename; 44*e992f068Schristos } u; 4575fd0b74Schristos }; 4675fd0b74Schristos 4775fd0b74Schristos /* Implements the .file FILENO "FILENAME" directive. FILENO can be 0 4875fd0b74Schristos to indicate that no file number has been assigned. All real file 49ede78133Schristos number must be >0. The second form returns the filename extracted 50ede78133Schristos from the input stream. */ 51ede78133Schristos extern void dwarf2_directive_file (int); 52ede78133Schristos extern char * dwarf2_directive_filename (void); 5375fd0b74Schristos 5475fd0b74Schristos /* Implements the .loc FILENO LINENO [COLUMN] directive. FILENO is 5575fd0b74Schristos the file number, LINENO the line number and the (optional) COLUMN 5675fd0b74Schristos the column of the source code that the following instruction 5775fd0b74Schristos corresponds to. FILENO can be 0 to indicate that the filename 5875fd0b74Schristos specified by the textually most recent .file directive should be 5975fd0b74Schristos used. */ 60ede78133Schristos extern void dwarf2_directive_loc (int); 6175fd0b74Schristos 6275fd0b74Schristos /* Implements the .loc_mark_labels {0,1} directive. */ 63ede78133Schristos extern void dwarf2_directive_loc_mark_labels (int); 6475fd0b74Schristos 6575fd0b74Schristos /* Returns the current source information. If .file directives have 6675fd0b74Schristos been encountered, the info for the corresponding source file is 6775fd0b74Schristos returned. Otherwise, the info for the assembly source file is 6875fd0b74Schristos returned. */ 69ede78133Schristos extern void dwarf2_where (struct dwarf2_line_info *); 7075fd0b74Schristos 7175fd0b74Schristos /* A hook to allow the target backend to inform the line number state 7275fd0b74Schristos machine of isa changes when assembler debug info is enabled. */ 73ede78133Schristos extern void dwarf2_set_isa (unsigned int); 7475fd0b74Schristos 7575fd0b74Schristos /* This function generates .debug_line info based on the address and 7675fd0b74Schristos source information passed in the arguments. ADDR should be the 7775fd0b74Schristos frag-relative offset of the instruction the information is for and 7875fd0b74Schristos L is the source information that should be associated with that 7975fd0b74Schristos address. */ 80ede78133Schristos extern void dwarf2_gen_line_info (addressT, struct dwarf2_line_info *); 8175fd0b74Schristos 8275fd0b74Schristos /* Must be called for each generated instruction. */ 8375fd0b74Schristos extern void dwarf2_emit_insn (int); 8475fd0b74Schristos 8575fd0b74Schristos void dwarf2_move_insn (int); 8675fd0b74Schristos 8775fd0b74Schristos /* Reset the state of the line number information to reflect that 8875fd0b74Schristos it has been used. */ 8975fd0b74Schristos extern void dwarf2_consume_line_info (void); 9075fd0b74Schristos 9175fd0b74Schristos /* Should be called for each code label. */ 9275fd0b74Schristos extern void dwarf2_emit_label (symbolS *); 9375fd0b74Schristos 9475fd0b74Schristos /* True when we've seen a .loc directive recently. Used to avoid 9575fd0b74Schristos doing work when there's nothing to do. */ 96*e992f068Schristos extern bool dwarf2_loc_directive_seen; 9775fd0b74Schristos 9875fd0b74Schristos /* True when we're supposed to set the basic block mark whenever a label 9975fd0b74Schristos is seen. Unless the target is doing Something Weird, just call 10075fd0b74Schristos dwarf2_emit_label. */ 101*e992f068Schristos extern bool dwarf2_loc_mark_labels; 10275fd0b74Schristos 10375fd0b74Schristos extern void dwarf2_init (void); 10475fd0b74Schristos 10575fd0b74Schristos extern void dwarf2_finish (void); 10675fd0b74Schristos 10775fd0b74Schristos extern int dwarf2dbg_estimate_size_before_relax (fragS *); 10875fd0b74Schristos extern int dwarf2dbg_relax_frag (fragS *); 10975fd0b74Schristos extern void dwarf2dbg_convert_frag (fragS *); 11075fd0b74Schristos 111ede78133Schristos extern void dwarf2dbg_final_check (void); 112ede78133Schristos 11375fd0b74Schristos /* An enumeration which describes the sizes of offsets (to DWARF sections) 11475fd0b74Schristos and the mechanism by which the size is indicated. */ 115ede78133Schristos enum dwarf2_format 116ede78133Schristos { 11775fd0b74Schristos /* 32-bit format: the initial length field is 4 bytes long. */ 11875fd0b74Schristos dwarf2_format_32bit, 11975fd0b74Schristos /* DWARF3 64-bit format: the representation of the initial length 12075fd0b74Schristos (of a DWARF section) is 0xffffffff (4 bytes) followed by eight 12175fd0b74Schristos bytes indicating the actual length. */ 12275fd0b74Schristos dwarf2_format_64bit, 12375fd0b74Schristos /* SGI extension to DWARF2: The initial length is eight bytes. */ 12475fd0b74Schristos dwarf2_format_64bit_irix 12575fd0b74Schristos }; 12675fd0b74Schristos 12775fd0b74Schristos #endif /* AS_DWARF2DBG_H */ 128