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]

[UPC 12/22] DWARF support


Background
----------

An overview email, describing the UPC-related changes is here:
  https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00005.html

The GUPC branch is described here:
  http://gcc.gnu.org/projects/gupc.html

The UPC-related source code differences are summarized here:
  http://gccupc.org/gupc-changes

All languages (c, c++, fortran, go, lto, objc, obj-c++) have been
bootstrapped; no test suite regressions were introduced,
relative to the GCC trunk.

If you are on the cc-list, your name was chosen either
because you are listed as a maintainer for the area that
applies to the patches described in this email, or you
were a frequent contributor of patches made to files listed
in this email.

In the change log entries included in each patch, the directory
containing the affected files is listed, followed by the files.
When the patches are applied, the change log entries will be
distributed to the appropriate ChangeLog file.

Overview
--------

The Dwarf4 specification defines extensions which add support for UPC.
See: http://dwarfstd.org/doc/DWARF4.pdf for details.  These extensions
are defined in <top-level>/include/dwarf2.def.  The patch below
implements UPC debugging support.  This support is enabled via
the -dwarf-2-upc compilation switch.  It is not enabled by default,
because some older versions of GDB will abort when encountering
the UPC-related DWARF extensions.

A few years back, we added support to GDB for UPC, though that
support was experimental and not pushed back into the mainline.
A couple of commercial parallel debuggers implemented support
for GNU UPC, utilizing these DWARF extensions.

2015-11-30  Gary Funck  <gary@intrepid.com>

	gcc/
	* dwarf2out.c (modified_type_die): If the type is shared qualified,
	generate UPC debugging information as defined in
	the DWARF4 specification.
	(add_subscript_info): If the array index is "THREADS scaled",
	add the DW_AT_upc_threads_scaled attribute to the subrange DIE.
	(gen_compile_unit_die): If -fupc is asserted,
	set the language to DW_LANG_Upc.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(.../trunk)	(revision 231059)
+++ gcc/dwarf2out.c	(.../branches/gupc)	(revision 231080)
@@ -10899,6 +10899,50 @@ modified_type_die (tree type, int cv_qua
 	    mod_type_die = d;
 	  }
     }
+  else if (use_upc_dwarf2_extensions
+           && (cv_quals & TYPE_QUAL_SHARED))
+    {
+      HOST_WIDE_INT block_factor = 1;
+
+      /* Inside the compiler,
+         "shared int x;" TYPE_BLOCK_FACTOR is null.
+         "shared [] int *p;" TYPE_BLOCK_FACTOR is zero.
+         "shared [10] int x[50];" TYPE_BLOCK_FACTOR is 10 * bitsize(int)
+         The DWARF2 encoding is as follows:
+         "shared int x;"  DW_AT_count: 1
+         "shared [] int *p;" <no DW_AT_count attribute>
+         "shared [10] int x[50];" DW_AT_count: 10
+         The logic below handles thse various contingencies.  */
+
+      mod_type_die = new_die (DW_TAG_upc_shared_type,
+                                  comp_unit_die (), type);
+
+      if (TYPE_HAS_BLOCK_FACTOR (type))
+        block_factor = TREE_INT_CST_LOW (TYPE_BLOCK_FACTOR (type));
+
+      if (block_factor != 0)
+        add_AT_unsigned (mod_type_die, DW_AT_count, block_factor);
+
+      sub_die = modified_type_die (type,
+                           cv_quals & ~TYPE_QUAL_SHARED,
+                           context_die);
+    }
+  else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_STRICT)
+    {
+      mod_type_die = new_die (DW_TAG_upc_strict_type,
+                                  comp_unit_die (), type);
+      sub_die = modified_type_die (type,
+                           cv_quals & ~TYPE_QUAL_STRICT,
+                           context_die);
+    }
+  else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_RELAXED)
+    {
+      mod_type_die = new_die (DW_TAG_upc_relaxed_type,
+                                  comp_unit_die (), type);
+      sub_die = modified_type_die (type,
+                           cv_quals & ~TYPE_QUAL_RELAXED,
+                           context_die);
+    }
   else if (code == POINTER_TYPE || code == REFERENCE_TYPE)
     {
       dwarf_tag tag = DW_TAG_pointer_type;
@@ -16992,6 +17036,12 @@ add_subscript_info (dw_die_ref type_die,
       if (!subrange_die)
 	subrange_die = new_die (DW_TAG_subrange_type, type_die, NULL);
 
+
+      if (use_upc_dwarf2_extensions && TYPE_HAS_THREADS_FACTOR (type))
+        {
+	  add_AT_flag (subrange_die, DW_AT_upc_threads_scaled, 1);
+	}
+
       if (domain)
 	{
 	  /* We have an array type with specified bounds.  */
@@ -20279,6 +20329,10 @@ gen_compile_unit_die (const char *filena
 	  if (dwarf_version >= 5 /* || !dwarf_strict */)
 	    if (strcmp (language_string, "GNU C11") == 0)
 	      language = DW_LANG_C11;
+
+          if (use_upc_dwarf2_extensions && flag_upc)
+            language = DW_LANG_Upc;
+
 	}
     }
   else if (strncmp (language_string, "GNU C++", 7) == 0)


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