]> sourceware.org Git - systemtap.git/commitdiff
PR11474: Don't manually iterate over CUs for @cast
authorJosh Stone <jistone@redhat.com>
Wed, 7 Apr 2010 21:33:24 +0000 (14:33 -0700)
committerJosh Stone <jistone@redhat.com>
Wed, 7 Apr 2010 21:57:53 +0000 (14:57 -0700)
Since commit 063906a9, we can just let dwflpp look everywhere for the
type on our behalf.  Thanks dwflpp!

* tapsets.cxx (dwarf_cast_query::handle_query_module): Call dwflpp's
  declaration_resolve_other_cus, focus on the CU, and expand.
  (dwarf_cast_query::handle_query_cu): Remove.
  (dwarf_cast_query::cast_query_cu): Remove.

tapsets.cxx

index 7b04f79435017e6855462aa19146d0320d9ddd61..4b4fd513ccb20a2f182f96ec80760e0ab2e10e44 100644 (file)
@@ -2748,9 +2748,6 @@ struct dwarf_cast_query : public base_query
     pe_type(pe_type), code(code) {}
 
   void handle_query_module();
-  int handle_query_cu(Dwarf_Die * cudie);
-
-  static int cast_query_cu (Dwarf_Die * cudie, void * arg);
 };
 
 
@@ -2760,46 +2757,24 @@ dwarf_cast_query::handle_query_module()
   if (!code.empty())
     return;
 
-  // look for the type in each CU
-  dw.iterate_over_cus(cast_query_cu, this);
-}
-
-
-int
-dwarf_cast_query::handle_query_cu(Dwarf_Die * cudie)
-{
-  if (!code.empty())
-    return DWARF_CB_ABORT;
+  // look for the type in any CU
+  Dwarf_Die* type_die = dw.declaration_resolve_other_cus(e.type.c_str());
+  if (!type_die)
+    return;
 
-  dw.focus_on_cu (cudie);
-  Dwarf_Die* type_die = dw.declaration_resolve(e.type.c_str());
-  if (type_die)
+  try
     {
-      try
-        {
-          code = dw.literal_stmt_for_pointer (type_die, &e,
-                                              lvalue, pe_type);
-        }
-      catch (const semantic_error& er)
-        {
-          // XXX might be better to try again in another CU
-         // NB: we can have multiple errors, since a @cast
-         // may be expanded in several different contexts:
-         //     function ("*") { @cast(...) }
-          e.chain (new semantic_error(er));
-        }
-      return DWARF_CB_ABORT;
+      Dwarf_Die cu_mem;
+      dw.focus_on_cu(dwarf_diecu(type_die, &cu_mem, NULL, NULL));
+      code = dw.literal_stmt_for_pointer (type_die, &e, lvalue, pe_type);
+    }
+  catch (const semantic_error& er)
+    {
+      // NB: we can have multiple errors, since a @cast
+      // may be expanded in several different contexts:
+      //     function ("*") { @cast(...) }
+      e.chain (new semantic_error(er));
     }
-  return DWARF_CB_OK;
-}
-
-
-int
-dwarf_cast_query::cast_query_cu (Dwarf_Die * cudie, void * arg)
-{
-  dwarf_cast_query * q = static_cast<dwarf_cast_query *>(arg);
-  if (pending_interrupts) return DWARF_CB_ABORT;
-  return q->handle_query_cu(cudie);
 }
 
 
This page took 0.044772 seconds and 5 git commands to generate.