GCC Middle and Back End API Reference
dwarf2out.h File Reference
#include "dwarf2.h"
Include dependency graph for dwarf2out.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  dw_cfi_oprnd
 
struct  dw_cfi_node
 
struct  dw_fde_node
 
struct  cfa_reg
 
struct  dw_cfa_location
 
struct  dw_vec_const
 
struct  dw_discr_value
 
struct  dw_val_node
 
union  dw_val_node::dw_val_struct_union
 
struct  dw_val_node::dw_val_struct_union::dw_val_die_union
 
struct  dw_val_node::dw_val_struct_union::dw_val_vms_delta_union
 
struct  dw_loc_descr_node
 
struct  dw_discr_list_node
 
struct  dw_wide_int
 
struct  array_descr_info
 
struct  array_descr_info::array_descr_dimen
 
struct  fixed_point_type_info
 
struct  dw_attr_struct
 
struct  dwarf_file_data
 

Macros

#define DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN   16
 

Typedefs

typedef struct die_structdw_die_ref
 
typedef const struct die_structconst_dw_die_ref
 
typedef struct dw_val_nodedw_val_ref
 
typedef struct dw_cfi_nodedw_cfi_ref
 
typedef struct dw_loc_descr_nodedw_loc_descr_ref
 
typedef struct dw_loc_list_structdw_loc_list_ref
 
typedef struct dw_discr_list_nodedw_discr_list_ref
 
typedef struct dw_wide_intdw_wide_int_ptr
 
typedef vec< dw_cfi_ref, va_gc > * cfi_vec
 
typedef struct dw_fde_nodedw_fde_ref
 
typedef struct dw_attr_struct dw_attr_node
 

Enumerations

enum  dw_cfi_oprnd_type {
  dw_cfi_oprnd_unused , dw_cfi_oprnd_reg_num , dw_cfi_oprnd_offset , dw_cfi_oprnd_addr ,
  dw_cfi_oprnd_loc , dw_cfi_oprnd_cfa_loc
}
 
enum  dw_val_class {
  dw_val_class_none , dw_val_class_addr , dw_val_class_offset , dw_val_class_loc ,
  dw_val_class_loc_list , dw_val_class_range_list , dw_val_class_const , dw_val_class_unsigned_const ,
  dw_val_class_const_double , dw_val_class_wide_int , dw_val_class_vec , dw_val_class_flag ,
  dw_val_class_die_ref , dw_val_class_fde_ref , dw_val_class_lbl_id , dw_val_class_lineptr ,
  dw_val_class_str , dw_val_class_macptr , dw_val_class_loclistsptr , dw_val_class_file ,
  dw_val_class_data8 , dw_val_class_decl_ref , dw_val_class_vms_delta , dw_val_class_high_pc ,
  dw_val_class_discr_value , dw_val_class_discr_list , dw_val_class_const_implicit , dw_val_class_unsigned_const_implicit ,
  dw_val_class_file_implicit , dw_val_class_view_list , dw_val_class_symview
}
 
enum  array_descr_ordering { array_descr_ordering_default , array_descr_ordering_row_major , array_descr_ordering_column_major }
 
enum  fixed_point_scale_factor { fixed_point_scale_factor_binary , fixed_point_scale_factor_decimal , fixed_point_scale_factor_arbitrary }
 

Functions

struct dw_loc_descr_nodebuild_cfa_loc (dw_cfa_location *, poly_int64)
 
struct dw_loc_descr_nodebuild_cfa_aligned_loc (dw_cfa_location *, poly_int64, HOST_WIDE_INT)
 
struct dw_loc_descr_nodebuild_span_loc (struct cfa_reg)
 
struct dw_loc_descr_nodemem_loc_descriptor (rtx, machine_mode mode, machine_mode mem_mode, enum var_init_status)
 
bool loc_descr_equal_p (dw_loc_descr_ref, dw_loc_descr_ref)
 
dw_fde_ref dwarf2out_alloc_current_fde (void)
 
unsigned long size_of_locs (dw_loc_descr_ref)
 
void output_loc_sequence (dw_loc_descr_ref, int)
 
void output_loc_sequence_raw (dw_loc_descr_ref)
 
void lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
 
bool cfa_equal_p (const dw_cfa_location *, const dw_cfa_location *)
 
void output_cfi (dw_cfi_ref, dw_fde_ref, int)
 
enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc (enum dwarf_call_frame_info cfi)
 
enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi)
 
void output_cfi_directive (FILE *f, struct dw_cfi_node *cfi)
 
void dwarf2out_emit_cfi (dw_cfi_ref cfi)
 
void debug_dwarf (void)
 
void debug_dwarf_die (struct die_struct *)
 
void debug_dwarf_loc_descr (dw_loc_descr_ref)
 
void debug (die_struct &ref)
 
void debug (die_struct *ptr)
 
void dwarf2out_set_demangle_name_func (const char *(*)(const char *))
 
void dwarf2cfi_cc_finalize (void)
 
void dwarf2out_cc_finalize (void)
 
dw_attr_nodeget_AT (dw_die_ref, enum dwarf_attribute)
 
HOST_WIDE_INT AT_int (dw_attr_node *)
 
unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *a)
 
dw_loc_descr_ref AT_loc (dw_attr_node *)
 
dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute)
 
const charget_AT_string (dw_die_ref, enum dwarf_attribute)
 
enum dw_val_class AT_class (dw_attr_node *)
 
unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute)
 
int get_AT_flag (dw_die_ref, enum dwarf_attribute)
 
void add_name_attribute (dw_die_ref, const char *)
 
dw_die_ref new_die_raw (enum dwarf_tag)
 
dw_die_ref base_type_die (tree, bool)
 
dw_die_ref lookup_decl_die (tree)
 
dw_die_ref lookup_type_die (tree)
 
dw_die_ref dw_get_die_child (dw_die_ref)
 
dw_die_ref dw_get_die_sib (dw_die_ref)
 
enum dwarf_tag dw_get_die_tag (dw_die_ref)
 
struct dwarf_file_dataget_AT_file (dw_die_ref, enum dwarf_attribute)
 

Variables

cfi_vec cie_cfi_vec
 

Macro Definition Documentation

◆ DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN

#define DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN   16

Typedef Documentation

◆ cfi_vec

◆ const_dw_die_ref

◆ dw_attr_node

Some DWARF internals are exposed for the needs of DWARF-based debug
formats.   
Each DIE attribute has a field specifying the attribute kind,
a link to the next attribute in the chain, and an attribute value.
Attributes are typically linked below the DIE they modify.   

◆ dw_cfi_ref

◆ dw_die_ref

dwarf2out.h - Various declarations for functions found in dwarf2out.cc
   Copyright (C) 1998-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

◆ dw_discr_list_ref

◆ dw_fde_ref

◆ dw_loc_descr_ref

◆ dw_loc_list_ref

◆ dw_val_ref

◆ dw_wide_int_ptr

Enumeration Type Documentation

◆ array_descr_ordering

Enumerator
array_descr_ordering_default 
array_descr_ordering_row_major 
array_descr_ordering_column_major 

◆ dw_cfi_oprnd_type

Call frames are described using a sequence of Call Frame
Information instructions.  The register number, offset
and address fields are provided as possible operands;
their use is selected by the opcode field.   
Enumerator
dw_cfi_oprnd_unused 
dw_cfi_oprnd_reg_num 
dw_cfi_oprnd_offset 
dw_cfi_oprnd_addr 
dw_cfi_oprnd_loc 
dw_cfi_oprnd_cfa_loc 

◆ dw_val_class

Each DIE may have a series of attribute/value pairs.  Values
can take on several forms.  The forms that are used in this
implementation are listed below.   
Enumerator
dw_val_class_none 
dw_val_class_addr 
dw_val_class_offset 
dw_val_class_loc 
dw_val_class_loc_list 
dw_val_class_range_list 
dw_val_class_const 
dw_val_class_unsigned_const 
dw_val_class_const_double 
dw_val_class_wide_int 
dw_val_class_vec 
dw_val_class_flag 
dw_val_class_die_ref 
dw_val_class_fde_ref 
dw_val_class_lbl_id 
dw_val_class_lineptr 
dw_val_class_str 
dw_val_class_macptr 
dw_val_class_loclistsptr 
dw_val_class_file 
dw_val_class_data8 
dw_val_class_decl_ref 
dw_val_class_vms_delta 
dw_val_class_high_pc 
dw_val_class_discr_value 
dw_val_class_discr_list 
dw_val_class_const_implicit 
dw_val_class_unsigned_const_implicit 
dw_val_class_file_implicit 
dw_val_class_view_list 
dw_val_class_symview 

◆ fixed_point_scale_factor

Enumerator
fixed_point_scale_factor_binary 
fixed_point_scale_factor_decimal 
fixed_point_scale_factor_arbitrary 

Function Documentation

◆ add_name_attribute()

void add_name_attribute ( dw_die_ref die,
const char * name_string )
extern
Generate a DW_AT_name attribute given some string value to be included as
the value of the attribute.   

References add_AT_string(), demangle_name_func, ggc_alloc(), and NULL.

Referenced by add_discr_value(), ctf_debug_init(), gen_block_die(), gen_type_die(), and modified_type_die().

◆ AT_class()

◆ AT_int()

◆ AT_loc()

◆ AT_unsigned()

◆ base_type_die()

◆ build_cfa_aligned_loc()

struct dw_loc_descr_node * build_cfa_aligned_loc ( dw_cfa_location * cfa,
poly_int64 offset,
HOST_WIDE_INT alignment )
extern
This function builds a dwarf location descriptor sequence for
the address at OFFSET from the CFA when stack is aligned to
ALIGNMENT byte.   

References add_loc_descr(), DWARF_FRAME_REGNUM, ggc_alloc(), HARD_FRAME_POINTER_REGNUM, dw_cfa_location::indirect, int_loc_descriptor(), loc_descr_plus_const(), new_loc_descr(), new_reg_loc_descr(), offset, cfa_reg::reg, and dw_cfa_location::reg.

Referenced by reg_save().

◆ build_cfa_loc()

struct dw_loc_descr_node * build_cfa_loc ( dw_cfa_location * cfa,
poly_int64 offset )
extern
Interface from dwarf2out.cc to dwarf2cfi.cc.   
This function builds a dwarf location descriptor sequence from a
dw_cfa_location, adding the given OFFSET to the result of the
expression.   

References add_loc_descr(), dw_cfa_location::base_offset, build_span_loc(), dw_val_class_const, ggc_alloc(), dw_cfa_location::indirect, loc_descr_plus_const(), new_loc_descr(), new_reg_loc_descr(), NULL, dw_cfa_location::offset, offset, cfa_reg::reg, dw_cfa_location::reg, and cfa_reg::span.

Referenced by convert_cfa_to_fb_loc_list(), def_cfa_0(), and reg_save().

◆ build_span_loc()

struct dw_loc_descr_node * build_span_loc ( struct cfa_reg reg)
extern
Build a dwarf location for a cfa_reg spanning multiple
consecutive registers.   

References add_loc_descr(), build_breg_loc(), gcc_assert, ggc_alloc(), i, int_loc_descriptor(), new_loc_descr(), NULL, cfa_reg::reg, cfa_reg::span, and cfa_reg::span_width.

Referenced by build_cfa_loc(), and reg_save().

◆ cfa_equal_p()

bool cfa_equal_p ( const dw_cfa_location * loc1,
const dw_cfa_location * loc2 )
extern
Determine if two dw_cfa_location structures define the same data.   

References ggc_alloc(), and known_eq.

Referenced by cfi_oprnd_equal_p(), cfi_row_equal_p(), convert_cfa_to_fb_loc_list(), and def_cfa_0().

◆ debug() [1/2]

void debug ( die_struct & ref)
extern

References ggc_alloc(), and print_die().

◆ debug() [2/2]

void debug ( die_struct * ptr)
extern

References debug, and ggc_alloc().

◆ debug_dwarf()

void debug_dwarf ( void )
extern
Print all DWARF information collected for the compilation unit.
This routine is a debugging aid only.   

References comp_unit_die(), ggc_alloc(), print_die(), and print_indent.

◆ debug_dwarf_die()

void debug_dwarf_die ( struct die_struct * )
extern

◆ debug_dwarf_loc_descr()

void debug_dwarf_loc_descr ( dw_loc_descr_ref loc)
extern
Print the list of operations in the LOC location description.   

References ggc_alloc(), and print_loc_descr().

◆ dw_cfi_oprnd1_desc()

enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc ( enum dwarf_call_frame_info cfi)
extern
Interface from dwarf2*.c to the rest of the compiler.   
Describe for the GTY machinery what parts of dw_cfi_oprnd1 are used.   

References dw_cfi_oprnd_addr, dw_cfi_oprnd_loc, dw_cfi_oprnd_offset, dw_cfi_oprnd_reg_num, dw_cfi_oprnd_unused, gcc_unreachable, and ggc_alloc().

Referenced by cfi_equal_p().

◆ dw_cfi_oprnd2_desc()

enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc ( enum dwarf_call_frame_info cfi)
extern
Describe for the GTY machinery what parts of dw_cfi_oprnd2 are used.   

References dw_cfi_oprnd_cfa_loc, dw_cfi_oprnd_loc, dw_cfi_oprnd_offset, dw_cfi_oprnd_reg_num, dw_cfi_oprnd_unused, and ggc_alloc().

Referenced by cfi_equal_p().

◆ dw_get_die_child()

dw_die_ref dw_get_die_child ( dw_die_ref die)
extern
Return a reference to the children list of a given DIE.   

References die_struct::die_child.

Referenced by gen_ctf_array_type(), gen_ctf_enumeration_type(), gen_ctf_function_type(), and gen_ctf_sou_type().

◆ dw_get_die_sib()

dw_die_ref dw_get_die_sib ( dw_die_ref die)
extern
Return a reference to the sibling of a given DIE.   

References die_struct::die_sib.

Referenced by gen_ctf_array_type(), gen_ctf_enumeration_type(), gen_ctf_function_type(), gen_ctf_sou_type(), and gen_ctf_subrange_type().

◆ dw_get_die_tag()

enum dwarf_tag dw_get_die_tag ( dw_die_ref die)
extern

◆ dwarf2cfi_cc_finalize()

void dwarf2cfi_cc_finalize ( void )

◆ dwarf2out_alloc_current_fde()

◆ dwarf2out_cc_finalize()

void dwarf2out_cc_finalize ( void )
Reset all state within dwarf2out.cc so that we can rerun the compiler
within the same process.  For use by toplev::finalize.   

Referenced by toplev::finalize().

◆ dwarf2out_emit_cfi()

void dwarf2out_emit_cfi ( dw_cfi_ref cfi)
extern

◆ dwarf2out_set_demangle_name_func()

void dwarf2out_set_demangle_name_func ( const char * *)(const char *)
extern

◆ get_AT()

◆ get_AT_file()

struct dwarf_file_data * get_AT_file ( dw_die_ref die,
enum dwarf_attribute )
extern

References a, AT_file(), get_AT(), ggc_alloc(), and NULL.

Referenced by ctf_get_die_loc_file().

◆ get_AT_flag()

int get_AT_flag ( dw_die_ref die,
enum dwarf_attribute attr_kind )
extern
Return the value of the flag attribute designated by ATTR_KIND, or -1
if it is not present.   

References a, AT_flag(), get_AT(), and ggc_alloc().

Referenced by gen_ctf_array_type(), gen_ctf_enumeration_type(), gen_ctf_function_type(), gen_ctf_sou_type(), gen_ctf_variable(), and output_pubname().

◆ get_AT_ref()

◆ get_AT_string()

◆ get_AT_unsigned()

◆ loc_descr_equal_p()

bool loc_descr_equal_p ( dw_loc_descr_ref a,
dw_loc_descr_ref b )
extern
Compare two complete location expressions for exact equality.   

References a, b, loc_descr_equal_p_1(), and NULL.

Referenced by cfi_oprnd_equal_p().

◆ lookup_cfa_1()

void lookup_cfa_1 ( dw_cfi_ref cfi,
dw_cfa_location * loc,
dw_cfa_location * remember )
extern
Interface from dwarf2cfi.cc to dwarf2out.cc.   
Find the previous value for the CFA, iteratively.  CFI is the opcode
to interpret, *LOC will be updated as necessary, *REMEMBER is used for
one level of remember/restore state processing.   

References gcc_assert, get_cfa_from_loc_descr(), ggc_alloc(), dw_cfa_location::offset, dw_cfa_location::reg, and cfa_reg::set_by_dwreg().

Referenced by convert_cfa_to_fb_loc_list().

◆ lookup_decl_die()

◆ lookup_type_die()

◆ mem_loc_descriptor()

struct dw_loc_descr_node * mem_loc_descriptor ( rtx rtl,
machine_mode mode,
machine_mode mem_mode,
enum var_init_status initialized )
extern
The following routine converts the RTL for a variable or parameter
(resident in memory) into an equivalent Dwarf representation of a
mechanism for getting the address of that same variable onto the top of a
hypothetical "address evaluation" stack.

When creating memory location descriptors, we are effectively transforming
the RTL for a memory-resident object into its Dwarf postfix expression
equivalent.  This routine recursively descends an RTL tree, turning
it into Dwarf postfix code as it goes.

MODE is the mode that should be assumed for the rtl if it is VOIDmode.

MEM_MODE is the mode of the memory reference, needed to handle some
autoincrement addressing modes.

Return 0 if we can't represent the location.   

References add_loc_descr(), alloc_dw_wide_int(), arg_pointer_rtx, avoid_constant_pool_reference(), base_type_for_mode(), based_loc_descr(), bswap_loc_descriptor(), clz_loc_descriptor(), CONST_INT_P, const_ok_for_output(), const_ok_for_output_1(), CONSTANT_P, convert_descriptor_to_mode(), crtl, debugger_reg_number(), dw_val_node::dw_val_struct_union::dw_val_die_union::die, do_binop(), do_unop(), dtprel_false, dtprel_true, dw_loc_descr_node::dw_loc_opc, dw_loc_descr_node::dw_loc_oprnd1, dw_loc_descr_node::dw_loc_oprnd2, dw_val_class_const, dw_val_class_const_double, dw_val_class_die_ref, dw_val_class_loc, dw_val_class_vec, dw_val_class_wide_int, DWARF2_ADDR_SIZE, dwarf_OP(), ENTRY_VALUE_EXP, expansion_failed(), dw_val_node::dw_val_struct_union::dw_val_die_union::external, FOR_EACH_SUBRTX_VAR, frame_pointer_rtx, double_int::from_shwi(), gcc_assert, gcc_unreachable, gen_int_mode(), get_address_mode(), GET_CODE, GET_MODE, GET_MODE_BITSIZE(), GET_MODE_MASK, GET_MODE_SIZE(), GET_MODE_UNIT_SIZE, ggc_alloc(), HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, IGNORED_DWARF_REGNUM, initialized, insert_float(), int_loc_descriptor(), int_mode_for_size(), INTVAL, is_based_loc(), known_eq, loc_descr_plus_const(), mem_loc_descriptor(), MEM_P, minmax_loc_descriptor(), new_addr_loc_descr(), new_loc_descr(), NULL, NULL_RTX, NULL_TREE, one_reg_loc_descriptor(), parameter_ref_descriptor(), popcount_loc_descriptor(), print_rtl(), ptr_mode, REG_P, REGNO, resolve_one_addr(), rotate_loc_descriptor(), rtx_to_double_int(), rtx_to_poly_int64(), SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, scompare_loc_descriptor(), shift, size_of_int_loc_descriptor(), stack_realign_drap, subreg_lowpart_p(), SUBREG_REG, SYMBOL_REF_TLS_MODEL, targetm, tls_mem_loc_descriptor(), TLS_MODEL_NONE, trunc_int_for_mode(), typed_binop(), ucompare_loc_descriptor(), used_rtx_array, dw_val_node::v, dw_val_node::val_class, dw_val_node::dw_val_struct_union::val_die_ref, VAR_INIT_STATUS_INITIALIZED, VAR_INIT_STATUS_UNINITIALIZED, vec_safe_push(), word_mode, XEXP, XINT, XVECEXP, and XVECLEN.

Referenced by bswap_loc_descriptor(), clz_loc_descriptor(), cst_pool_loc_descr(), dw_loc_list_1(), dwarf2out_frame_debug_cfa_expression(), dwarf2out_frame_debug_cfa_val_expression(), loc_descriptor(), loc_list_from_tree_1(), mem_loc_descriptor(), minmax_loc_descriptor(), popcount_loc_descriptor(), reg_loc_descriptor(), rotate_loc_descriptor(), scompare_loc_descriptor(), typed_binop(), and ucompare_loc_descriptor().

◆ new_die_raw()

dw_die_ref new_die_raw ( enum dwarf_tag tag_value)
extern
Create and return a new die with TAG_VALUE as tag.   

References die_struct::die_tag, and ggc_alloc().

Referenced by add_AT_external_die_ref(), base_type_die(), clone_as_declaration(), clone_die(), ctf_debug_init(), modified_type_die(), and new_die().

◆ output_cfi()

◆ output_cfi_directive()

void output_cfi_directive ( FILE * f,
struct dw_cfi_node * cfi )
extern

◆ output_loc_sequence()

void output_loc_sequence ( dw_loc_descr_ref loc,
int for_eh_or_skip )
extern
Output a sequence of location operations.  
The for_eh_or_skip parameter controls whether register numbers are
converted using DWARF2_FRAME_REG_OUT, which is needed in the case that
hard reg numbers have been processed via DWARF_FRAME_REGNUM (i.e. for unwind
info).  This should be suppressed for the cases that have not been converted
(i.e. symbolic debug info), by setting the parameter < 0.  See PR47324.   


References dw2_asm_output_data(), dw_loc_descr_node::dw_loc_next, dw_loc_descr_node::dw_loc_opc, DWARF2_FRAME_REG_OUT, dwarf_stack_op_name(), gcc_assert, ggc_alloc(), NULL, output_loc_operands(), and r.

Referenced by output_cfa_loc(), output_die(), output_loc_list(), and output_loc_operands().

◆ output_loc_sequence_raw()

◆ size_of_locs()

Variable Documentation

◆ cie_cfi_vec

cfi_vec cie_cfi_vec
extern
A vector of call frame insns for the CIE.   

Referenced by convert_cfa_to_fb_loc_list(), create_cie_data(), execute_dwarf2_frame(), and output_call_frame_info().