]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Emit discriminators for inlined call sites.
authorEugene Rozenfeld <erozen@microsoft.com>
Thu, 21 Apr 2022 23:17:52 +0000 (16:17 -0700)
committerEugene Rozenfeld <erozen@microsoft.com>
Sat, 1 Oct 2022 00:35:39 +0000 (17:35 -0700)
This change is based on commit 9fa26998a63d4b22b637ed8702520819e408a694
by Dehao Chen in vendors/google/heads/gcc-4_8.

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:

* dwarf2out.cc (add_call_src_coords_attributes): Emit discriminators for inlined call sites.

gcc/dwarf2out.cc

index 2df7590402287f9c511be3b4123ca642f36e2b3f..e81044b8c482e87a5536206fd120edc15c754836 100644 (file)
@@ -24783,7 +24783,8 @@ add_call_src_coords_attributes (tree stmt, dw_die_ref die)
   if (RESERVED_LOCATION_P (BLOCK_SOURCE_LOCATION (stmt)))
     return;
 
-  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)
     {
@@ -24791,6 +24792,9 @@ add_call_src_coords_attributes (tree stmt, dw_die_ref die)
       add_AT_unsigned (die, DW_AT_call_line, s.line);
       if (debug_column_info && s.column)
        add_AT_unsigned (die, DW_AT_call_column, s.column);
+      unsigned discr = get_discriminator_from_loc (locus);
+       if (discr != 0)
+         add_AT_unsigned (die, DW_AT_GNU_discriminator, discr);
     }
 }