This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GOOGLE] Add discriminator for inlined callsite


Patch updated. BTW, do you think this patch should actually go into trunk?

Thanks,
Dehao

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);
     }
 }


On Mon, Aug 19, 2013 at 9:31 AM, Cary Coutant <ccoutant@google.com> wrote:
>> -  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_discr, discr);
>
> DW_AT_discr is used to identify the "discriminant" for variant
> records; we should not reuse it for the discriminator, even if it's
> the case that the other meaning could never apply to a
> DW_TAG_inlined_subroutine. You should instead add a new
> DW_AT_GNU_discriminator to include/dwarf2.def and use that. 0x2136
> looks like the next value in the GNU vendor range. Note that
> dwarf2.def lives in both GCC and binutils repos, so once you have
> approval to commit to the GCC repo, you'll need to commit the same
> change to the binutils repo as well.
>
> -cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]