> Patch updated. BTW, do you think this patch should actually go into trunk?
This is OK for google branches. I don't think it can go into trunk
like this, as it relies on get_discriminator_from_locus. In trunk, we
only have the discriminator assigned to a basic block.
-cary
> Index: include/dwarf2.def
> ===================================================================
> --- include/dwarf2.def (revision 201852)
> +++ include/dwarf2.def (working copy)
> @@ -390,6 +390,8 @@ DW_AT (DW_AT_GNU_ranges_base, 0x2132)
> DW_AT (DW_AT_GNU_addr_base, 0x2133)
> DW_AT (DW_AT_GNU_pubnames, 0x2134)
> DW_AT (DW_AT_GNU_pubtypes, 0x2135)
> +/* Attribute for discriminator. */
> +DW_AT (DW_AT_GNU_discriminator, 0x2136)
> /* VMS extensions. */
> DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
> /* GNAT extensions. */
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c (revision 201852)
> +++ gcc/dwarf2out.c (working copy)
> @@ -18815,12 +18815,16 @@ gen_label_die (tree decl, dw_die_ref context_die)
> static inline void
> add_call_src_coords_attributes (tree stmt, dw_die_ref die)
> {
> - expanded_location s = expand_location (BLOCK_SOURCE_LOCATION (stmt));
> + location_t locus = BLOCK_SOURCE_LOCATION (stmt);
> + expanded_location s = expand_location (locus);
>
> if (dwarf_version >= 3 || !dwarf_strict)
> {
> add_AT_file (die, DW_AT_call_file, lookup_filename (s.file));
> add_AT_unsigned (die, DW_AT_call_line, s.line);
> + unsigned discr = get_discriminator_from_locus (locus);
> + if (discr != 0)
> + add_AT_unsigned (die, DW_AT_GNU_discriminator, discr);
> }
> }
>