[Dwarf-Discuss] Reserving a new DW_AT_calling_convention value

John DelSignore jdelsign at totalviewtech.com
Wed Apr 1 14:52:17 PDT 2009

Roland McGrath wrote:
>> I would like to use a new DW_AT_calling_convention attribute value in  
>> the range DW_CC_lo_user .. DW_CC_hi_user. As far as I can tell, the  
>> only one currently in (public) use is DW_CC_GNU_renesas_sh (= 0x40).  
>> My question is: how does one go about reserving/obtaining such a  
>> number? Do you just take the next one that appears to be available and  
>> submit patches using this value to binutils (for elf/dwarf.h) and gdb?  
>> (and possibly dwarflib, and maybe others)
> In the lo_user..hi_user range, it is up to each "vendor" to decide the
> conventions for using that range.  The different implementors ("vendors")
> try to stay aware of each other's uses, but "vendor-specific extensions"
> means exactly that there is not any shared formal management of that space.

This arrangement kind-of stinks for debuggers that want to support lots of different compilers on lots of different platforms. The problems is that if there's a conflict, it's sometimes hard for the debugger to puzzle it out the meaning of a vendor value.

It would be nice if we (the DWARF workgroup) could informally keep track of the values that are in use just to decrease the odds of a conflict.

This is a problem particularly with the DW_AT_hi/lo_user range. Over the years, TotalView has gathered the following vendor values for a variety of compilers:

  DW_AT_lo_user                 = 0x2000,

  /* IRIX MIPS specific codes */
  DW_AT_MIPS_fde                        = 0x2001,
  DW_AT_MIPS_loop_begin                 = 0x2002,
  DW_AT_MIPS_tail_loop_begin            = 0x2003,
  DW_AT_MIPS_epilog_begin               = 0x2004,
  DW_AT_MIPS_loop_unroll_factor         = 0x2005,
  DW_AT_MIPS_software_pipeline_depth    = 0x2006,

  DW_AT_MIPS_linkage_name               = 0x2007, /* gcc uses this too :-( */

  DW_AT_MIPS_abstract_name              = 0x2009,
  DW_AT_MIPS_clone_origin               = 0x200a,
  DW_AT_MIPS_has_inlines                = 0x200b,

  DW_AT_MIPS_stride                     = 0x2008,
  DW_AT_MIPS_stride_byte                = 0x200c,
  DW_AT_MIPS_stride_elem                = 0x200d,

  DW_AT_MIPS_ptr_dopetype               = 0x200e,
  DW_AT_MIPS_allocatable_dopetype       = 0x200f,

  DW_AT_MIPS_assumed_shape_dopetype     = 0x2010,

  /* Compaq codes, only seen on Linux/Alpha so far, but maybe
   * they'll turn up on Linux/x86 too...
  DW_AT_CPQ_discontig_ranges            = 0x2001,   
  DW_AT_CPQ_semantic_events             = 0x2002,    
  DW_AT_CPQ_split_lifetimes_var         = 0x2003,
  DW_AT_CPQ_split_lifetimes_rtn         = 0x2004,
  DW_AT_CPQ_prologue_length             = 0x2005,

  DW_AT_HP_block_index                  = 0x2000,
  DW_AT_HP_unmodifiable                 = 0x2001,
  DW_AT_HP_actuals_stmt_list            = 0x2010,
  DW_AT_HP_proc_per_section             = 0x2011,
  DW_AT_HP_raw_data_ptr                 = 0x2012,
  DW_AT_HP_pass_by_reference            = 0x2013,
  DW_AT_HP_opt_level                    = 0x2014,
  DW_AT_HP_prof_version_id              = 0x2015,
  DW_AT_HP_opt_flags                    = 0x2016,
  DW_AT_HP_cold_region_low_pc           = 0x2017,
  DW_AT_HP_cold_region_high_pc          = 0x2018,
  DW_AT_HP_all_variables_modifiable     = 0x2019,
  DW_AT_HP_linkage_name                 = 0x201a,
  DW_AT_HP_prof_flags                   = 0x201b,  

  /* Intel extensions */
  DW_AT_endian     = 0x2026,		/* Flag: 1 if type is byte-swapped */

  /* GNU extensions ( As of Jan 16 09:50:37 2003)  */
  DW_AT_sf_names   = 0x2101,
  DW_AT_src_info   = 0x2102,
  DW_AT_mac_info   = 0x2103,
  DW_AT_src_coords = 0x2104,
  DW_AT_body_begin = 0x2105,
  DW_AT_body_end   = 0x2106,
  DW_AT_GNU_vector = 0x2107,
  /* Sun extensions */
  DW_AT_SUN_template	       = 0x2201,
  DW_AT_SUN_alignment	       = 0x2202,
  DW_AT_SUN_vtable	       = 0x2203,
  DW_AT_SUN_count_guarantee    = 0x2204,
  DW_AT_SUN_command_line       = 0x2205,
  DW_AT_SUN_vbase	       = 0x2206,
  DW_AT_SUN_compile_options    = 0x2207,
  DW_AT_SUN_language	       = 0x2208,
  DW_AT_SUN_browser_file       = 0x2209,
  DW_AT_SUN_vtable_abi         = 0x2210,
  DW_AT_SUN_func_offsets       = 0x2211,
  DW_AT_SUN_cf_kind            = 0x2212,
  DW_AT_SUN_vtable_index       = 0x2213,
  DW_AT_SUN_omp_tpriv_addr     = 0x2214,
  DW_AT_SUN_omp_child_func     = 0x2215,
  DW_AT_SUN_func_offset        = 0x2216,
  DW_AT_SUN_memop_type_ref     = 0x2217,
  DW_AT_SUN_profile_id         = 0x2218,
  DW_AT_SUN_memop_signature    = 0x2219,
  DW_AT_SUN_obj_dir            = 0x2220,
  DW_AT_SUN_obj_file           = 0x2221,  
  DW_AT_SUN_original_name      = 0x2222, 
  DW_AT_SUN_part_link_name     = 0x2225, /* This is part of the link name */
  DW_AT_SUN_link_name          = 0x2226, 

  /* PGI 5.0 (dwarf 2) extentions */
  DW_AT_lbase = 0x3a00,             /* block, constant, reference. This attribute is an ASTPLAB extension 
				       used to describe the array local base.  */
  DW_AT_soffset = 0x3a01,           /* block, constant, reference. ASTPLAB adds this attribute to describe 
					the section offset, or the offset to the first element in the dimension. */ 
  DW_AT_lstride = 0x3a02,           /* block, constant, reference. ASTPLAB adds this attribute to describe the 
				       linear stride or the distance between elements in the dimension. */

  DW_AT_upc_threads_scaled              = 0x3210,

  /* PGI Dwarf 2 extensions */
  DW_AT_PGI_lbase                       = 0x3a00,
  DW_AT_PGI_soffset                     = 0x3a01,
  DW_AT_PGI_lstride                     = 0x3a02,

  DW_AT_hi_user       = 0x3fff

Cheers, John D.

More information about the Dwarf-Discuss mailing list