2011-10-11 Sterling Augustine <saugustine@google.com>
[deliverable/binutils-gdb.git] / gdb / dwarf2read.c
index a139b96bbf6adf761559cd47e8ce05ddbd170377..2592bcff310fa1d1e7283bddaa1a2d097dfa7593 100644 (file)
@@ -3897,7 +3897,10 @@ partial_die_parent_scope (struct partial_die_info *pdi,
       return NULL;
     }
 
-  if (parent->tag == DW_TAG_namespace
+  if (pdi->tag == DW_TAG_enumerator)
+    /* Enumerators should not get the name of the enumeration as a prefix.  */
+    parent->scope = grandparent_scope;
+  else if (parent->tag == DW_TAG_namespace
       || parent->tag == DW_TAG_module
       || parent->tag == DW_TAG_structure_type
       || parent->tag == DW_TAG_class_type
@@ -3912,9 +3915,6 @@ partial_die_parent_scope (struct partial_die_info *pdi,
                                         grandparent_scope,
                                         parent->name, 0, cu);
     }
-  else if (parent->tag == DW_TAG_enumerator)
-    /* Enumerators should not get the name of the enumeration as a prefix.  */
-    parent->scope = grandparent_scope;
   else
     {
       /* FIXME drow/2004-04-01: What should we be doing with
@@ -6209,6 +6209,53 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
   memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
   call_site->pc = pc;
 
+  if (dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
+    {
+      struct die_info *func_die;
+
+      /* Skip also over DW_TAG_inlined_subroutine.  */
+      for (func_die = die->parent;
+          func_die && func_die->tag != DW_TAG_subprogram
+          && func_die->tag != DW_TAG_subroutine_type;
+          func_die = func_die->parent);
+
+      /* DW_AT_GNU_all_call_sites is a superset
+        of DW_AT_GNU_all_tail_call_sites.  */
+      if (func_die
+          && !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
+         && !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_tail_call_sites, cu))
+       {
+         /* TYPE_TAIL_CALL_LIST is not interesting in functions where it is
+            not complete.  But keep CALL_SITE for look ups via call_site_htab,
+            both the initial caller containing the real return address PC and
+            the final callee containing the current PC of a chain of tail
+            calls do not need to have the tail call list complete.  But any
+            function candidate for a virtual tail call frame searched via
+            TYPE_TAIL_CALL_LIST must have the tail call list complete to be
+            determined unambiguously.  */
+       }
+      else
+       {
+         struct type *func_type = NULL;
+
+         if (func_die)
+           func_type = get_die_type (func_die, cu);
+         if (func_type != NULL)
+           {
+             gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
+
+             /* Enlist this call site to the function.  */
+             call_site->tail_call_next = TYPE_TAIL_CALL_LIST (func_type);
+             TYPE_TAIL_CALL_LIST (func_type) = call_site;
+           }
+         else
+           complaint (&symfile_complaints,
+                      _("Cannot find function owning DW_TAG_GNU_call_site "
+                        "DIE 0x%x [in module %s]"),
+                      die->offset, cu->objfile->name);
+       }
+    }
+
   attr = dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
   if (attr == NULL)
     attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
@@ -6299,10 +6346,13 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
        }
       parameter->dwarf_reg = dwarf_block_to_dwarf_reg (DW_BLOCK (attr)->data,
                                 &DW_BLOCK (attr)->data[DW_BLOCK (attr)->size]);
-      if (parameter->dwarf_reg == -1)
+      if (parameter->dwarf_reg == -1
+         && !dwarf_block_to_sp_offset (gdbarch, DW_BLOCK (attr)->data,
+                                 &DW_BLOCK (attr)->data[DW_BLOCK (attr)->size],
+                                       &parameter->fb_offset))
        {
          complaint (&symfile_complaints,
-                    _("Only single DW_OP_reg is supported "
+                    _("Only single DW_OP_reg or DW_OP_fbreg is supported "
                       "for DW_FORM_block* DW_AT_location for "
                       "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
                     child_die->offset, cu->objfile->name);
This page took 0.02963 seconds and 4 git commands to generate.