Bug 867913 - Assertion `dwarf_tag(cu_die) == DW_TAG_compile_unit || dwarf_tag(cu_die) == DW_TAG_type_unit' failed.
Summary: Assertion `dwarf_tag(cu_die) == DW_TAG_compile_unit || dwarf_tag(cu_die) == D...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemtap
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mark Wielaard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-18 14:44 UTC by Roman Rakus
Modified: 2014-01-13 00:14 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-26 12:37:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 14742 0 None None None Never

Description Roman Rakus 2012-10-18 14:44:14 UTC
Description of problem:
When trying to use:
# stap -e 'probe process("/usr/lib64/cmpi/libcmpiCura_Account.so").function("*") { println(probefunc()); println($$parms$$) }'
I got the $Summary

Version-Release number of selected component (if applicable):
# stap -V 
Systemtap translator/driver (version 2.0/0.155, rpm 2.0-1.fc18)
Copyright (C) 2005-2012 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS BOOST_SHARED_PTR TR1_UNORDERED_MAP NLS DYNINST

Comment 1 Mark Wielaard 2012-10-18 15:06:58 UTC
The core issue is that systemtap dwflpp.cxx isn't expecting a DW_TAG_partial_unit which dwz generates now.

Simplest patch seems to be:

diff --git a/dwflpp.cxx b/dwflpp.cxx
index 5e27577..7921c99 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -1081,7 +1081,13 @@ dwflpp::iterate_over_globals (Dwarf_Die *cu_die,
 {
   assert (cu_die);
   assert (dwarf_tag(cu_die) == DW_TAG_compile_unit
-         || dwarf_tag(cu_die) == DW_TAG_type_unit);
+         || dwarf_tag(cu_die) == DW_TAG_type_unit
+         || dwarf_tag(cu_die) == DW_TAG_partial_unit);
+
+  // Ignore partial_unit, if they get imported by a real unit, then
+  // iterate_over_types will traverse them.
+  if (dwarf_tag(cu_die) == DW_TAG_partial_unit)
+    return DWARF_CB_OK;
 
   // If this is C++, recurse for any inner types
   bool has_inner_types = dwarf_srclang(cu_die) == DW_LANG_C_plus_plus;
@@ -1120,6 +1126,9 @@ dwflpp::iterate_over_types (Dwarf_Die *top_die,
       case DW_TAG_namespace:
         rc = (*callback)(&die, has_inner_types, prefix, data);
         break;
+      case DW_TAG_imported_unit:
+        rc = iterate_over_types(&die, has_inner_types, prefix, callback, data);
+        break;
       }
   while (rc == DWARF_CB_OK && dwarf_siblingof(&die, &die) == 0);
 
But there are a couple of other places where dwflpp.cxx does manual dwarf_child/dwarf_siblingof traversal which might need to account for DW_TAG_imported_unit.

Comment 2 Mark Wielaard 2012-10-22 00:05:49 UTC
There is more to it than the part in comment #1. See upstream bug/commit for a more complete fix:
http://sourceware.org/bugzilla/show_bug.cgi?id=14742


Note You need to log in before you can comment on or make changes to this bug.