]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: check_debug_info not a strong prerequisite of check_debug_aranges
authorPetr Machata <pmachata@redhat.com>
Wed, 21 Oct 2009 21:40:12 +0000 (23:40 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 12:55:12 +0000 (14:55 +0200)
src/dwarflint/checks-low.cc
src/dwarflint/checks-low.hh

index 1f6ac8fb1451901ca529c7b4053f272962980bf2..dd889c61ee16b00aac4a81ed71ae68c9e615460b 100644 (file)
@@ -353,13 +353,24 @@ check_debug_ranges::check_debug_ranges (dwarflint &lint)
 
 check_debug_aranges::check_debug_aranges (dwarflint &lint)
   : _m_sec_aranges (lint.check (_m_sec_aranges))
-  , _m_cus (lint.check (_m_cus))
 {
-  coverage *cov
-    = _m_cus->cu_cov.need_ranges ? NULL : &_m_cus->cu_cov.cov;
+  check_debug_info *info = toplev_check<check_debug_info> (lint);
+  coverage *cov = NULL;
+  if (info != NULL)
+    {
+      // xxx If need_ranges is true, we have to load ranges first.
+      // That's a flaw in design of checks, that data should have been
+      // stored in check_ranges, and that should have been requested
+      // explicitly.  But for the time being...
+      if (info->cu_cov.need_ranges)
+       toplev_check<check_debug_ranges> (lint);
+      if (!info->cu_cov.need_ranges)
+       cov = &info->cu_cov.cov;
+    }
+
   if (!check_aranges_structural (&_m_sec_aranges->file,
                                 &_m_sec_aranges->sect,
-                                &_m_cus->cus.front (),
+                                info != NULL ? &info->cus.front () : NULL,
                                 cov))
     throw check_base::failed (""); //xxx
 }
index 60b52bcb1aecf41f234b741f66bac107ee20791f..0519a17a29d8d78583c2efdc94461b57916eea4d 100644 (file)
@@ -54,6 +54,9 @@ class check_debug_info
   check_debug_abbrev *_m_abbrevs;
 
 public:
+  // The check pass adds all low_pc/high_pc ranges loaded from DIE
+  // tree into this following cu_cov structure.  If it finds any
+  // rangeptr-class attributes, it sets cu_cov.need_ranges to true.
   cu_coverage cu_cov;
   std::vector<cu> cus;
 
@@ -77,7 +80,6 @@ class check_debug_aranges
   : public check<check_debug_aranges>
 {
   section<sec_aranges> *_m_sec_aranges;
-  check_debug_info *_m_cus;
 
 public:
   explicit check_debug_aranges (dwarflint &lint);