]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Split checks-low.hh/cc into check_debug_aranges.hh/cc and sections.hh...
authorPetr Machata <pmachata@redhat.com>
Wed, 2 Dec 2009 18:26:17 +0000 (19:26 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 12:55:17 +0000 (14:55 +0200)
19 files changed:
src/Makefile.am
src/dwarflint/check_debug_abbrev.cc
src/dwarflint/check_debug_abbrev.hh
src/dwarflint/check_debug_aranges.cc [new file with mode: 0644]
src/dwarflint/check_debug_aranges.hh [new file with mode: 0644]
src/dwarflint/check_debug_info.cc
src/dwarflint/check_debug_info.hh
src/dwarflint/check_debug_line.cc
src/dwarflint/check_debug_loc_range.cc
src/dwarflint/check_debug_loc_range.hh
src/dwarflint/check_debug_pub.cc
src/dwarflint/check_dups_abstract_origin.cc
src/dwarflint/check_matching_ranges.cc
src/dwarflint/highlevel_check.cc
src/dwarflint/highlevel_check.hh
src/dwarflint/main.cc
src/dwarflint/sections.cc [moved from src/dwarflint/checks-low.cc with 92% similarity]
src/dwarflint/sections.hh [moved from src/dwarflint/checks-low.hh with 82% similarity]
src/dwarflint/sections.ii [new file with mode: 0644]

index 086e5c0e8ca1299dceaf8c06ebac40d9205251ee..26486b02f0c68dfaaaf832f546c8201f6c986980 100644 (file)
@@ -89,18 +89,19 @@ dwarflint_SOURCES = dwarfstrings.c \
                    dwarflint/messages.cc dwarflint/messages.h \
                    dwarflint/where.c dwarflint/where.h \
                    dwarflint/config.cc dwarflint/config.h \
-                   dwarflint/checks.hh \
-                   dwarflint/checks-low.cc dwarflint/checks-low.hh \
                    dwarflint/addr-record.cc dwarflint/addr-record.h \
                    dwarflint/reloc.cc dwarflint/reloc.h \
                    dwarflint/tables.cc dwarflint/tables.hh dwarflint/tables.h \
                    dwarflint/all-dies-it.hh \
+                   dwarflint/checks.hh \
+                   dwarflint/sections.cc dwarflint/sections.hh dwarflint/sections.ii \
                    dwarflint/highlevel_check.cc dwarflint/highlevel_check.hh \
                    dwarflint/check_debug_abbrev.cc dwarflint/check_debug_abbrev.hh dwarflint/check_debug_abbrev.ii \
                    dwarflint/check_debug_info.cc dwarflint/check_debug_info.hh dwarflint/check_debug_info.ii \
                    dwarflint/check_debug_line.cc \
                    dwarflint/check_debug_pub.cc \
                    dwarflint/check_debug_loc_range.cc dwarflint/check_debug_loc_range.hh \
+                   dwarflint/check_debug_aranges.cc dwarflint/check_debug_aranges.hh \
                    dwarflint/check_matching_ranges.cc \
                    dwarflint/check_range_out_of_scope.cc \
                    dwarflint/check_expected_trees.cc \
index 2271d2b7c6d2ff949e41ae90d6a3b5102beba428..03e3726dc0e76508cc50206e162817456d51c879 100644 (file)
 # include <config.h>
 #endif
 
-#include "checks-low.hh"
-#include "pri.hh"
-#include "tables.hh"
 #include "check_debug_info.hh"
 #include "check_debug_abbrev.hh"
+#include "pri.hh"
+#include "tables.hh"
+#include "sections.hh"
 
 #include <dwarf.h>
 #include <sstream>
index aeb0b9ffde3666596f02dbbfe658cb3da76f8066..efa6320a0791b475399f41b2f2917286857d4e28 100644 (file)
@@ -26,8 +26,6 @@
 #ifndef DWARFLINT_CHECK_DEBUG_ABBREV_HH
 #define DWARFLINT_CHECK_DEBUG_ABBREV_HH
 
-#include "checks-low.hh"
-
 class check_debug_abbrev
   : public check<check_debug_abbrev>
 {
diff --git a/src/dwarflint/check_debug_aranges.cc b/src/dwarflint/check_debug_aranges.cc
new file mode 100644 (file)
index 0000000..41cd4ce
--- /dev/null
@@ -0,0 +1,58 @@
+/* Low-level checking of .debug_aranges.
+   Copyright (C) 2009 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "low.h"
+#include "sections.hh"
+#include "check_debug_aranges.hh"
+#include "check_debug_info.hh"
+#include "check_debug_loc_range.hh"
+
+check_debug_aranges::check_debug_aranges (dwarflint &lint)
+  : _m_sec_aranges (lint.check (_m_sec_aranges))
+{
+  check_debug_info *info = lint.toplev_check<check_debug_info> ();
+  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)
+       lint.toplev_check<check_debug_ranges> ();
+      if (!info->cu_cov.need_ranges)
+       cov = &info->cu_cov.cov;
+    }
+
+  if (!check_aranges_structural (&_m_sec_aranges->file,
+                                &_m_sec_aranges->sect,
+                                info != NULL ? &info->cus.front () : NULL,
+                                cov))
+    throw check_base::failed ();
+}
diff --git a/src/dwarflint/check_debug_aranges.hh b/src/dwarflint/check_debug_aranges.hh
new file mode 100644 (file)
index 0000000..d2f6f87
--- /dev/null
@@ -0,0 +1,43 @@
+/* Low-level checking of .debug_aranges.
+   Copyright (C) 2009 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifndef DWARFLINT_CHECKS_LOW_HH
+#define DWARFLINT_CHECKS_LOW_HH
+
+#include "low.h"
+#include "checks.hh"
+#include "sections.ii"
+
+class check_debug_aranges
+  : public check<check_debug_aranges>
+{
+  section<sec_aranges> *_m_sec_aranges;
+
+public:
+  explicit check_debug_aranges (dwarflint &lint);
+};
+static reg<check_debug_aranges> reg_debug_aranges;
+
+#endif//DWARFLINT_CHECKS_LOW_HH
index fc3e8c1d0901aa01c3adbb411d32642005201d6b..441f6b69cc50fd5a58b0bc00cf5a517e60fa09bd 100644 (file)
@@ -35,6 +35,7 @@
 #include "messages.h"
 #include "pri.hh"
 #include "config.h"
+#include "sections.hh"
 #include "check_debug_loc_range.hh"
 #include "check_debug_abbrev.hh"
 #include "check_debug_info.hh"
index 1f8b7bf86ff255f464338263a79bba60dc5a06d3..e82ac7776682e4264ff9d0c3b51578f22d26fc27 100644 (file)
 #ifndef DWARFLINT_CHECK_DEBUG_INFO_HH
 #define DWARFLINT_CHECK_DEBUG_INFO_HH
 
-#include "checks-low.hh"
 #include "check_debug_abbrev.ii"
+#include "sections.ii"
+#include "checks.hh"
+#include "low.h"
 
 /** The pass for reading basic .debug_info data -- the layout of
     sections and their headers.  */
index 8ff26584c74ebf66795b9441c59b948ce37363c7..7b538c87f7202b4a9b1393d19cb0666c98ca0724 100644 (file)
@@ -1,5 +1,30 @@
-#include "checks-low.hh"
+/* Low-level checking of .debug_line.
+   Copyright (C) 2009 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
 #include "check_debug_info.hh"
+#include "sections.hh"
 #include "pri.hh"
 
 #include <dwarf.h>
index 8759e082218b0cdb098e7488d2e1df1f797075cd..26289ae7b59c599013bcd7fc6e7fc880de1ecd44 100644 (file)
@@ -40,6 +40,7 @@
 #include "config.h"
 #include "check_debug_loc_range.hh"
 #include "check_debug_info.hh"
+#include "sections.hh"
 #include "dwarf-opcodes.h"
 #include "pri.hh"
 
index 086c455e0881ac46561a1b169f01de84ef7e5a87..31373288bf0ae96b3bc375511ecccdad8a25d560 100644 (file)
@@ -1,5 +1,4 @@
-/* Routines related to .debug_loc and .debug_range.
-
+/* Low-level checking of .debug_loc and .debug_range.
    Copyright (C) 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Network licensing program, please visit www.openinventionnetwork.com
    <http://www.openinventionnetwork.com>.  */
 
-#include "checks-low.hh"
+#include "sections.ii"
 #include "check_debug_info.ii"
+#include "checks.hh"
+#include "messages.h"
+#include "low.h"
 
 class check_debug_ranges
   : public check<check_debug_ranges>
index 29d2b95e0edda6b01848903617897769a136508a..cd2aec087709380931b7457c42645dcf1129e3e5 100644 (file)
@@ -1,5 +1,30 @@
-#include "checks-low.hh"
+/* Low-level checking of .debug_pub*.
+   Copyright (C) 2009 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
 #include "check_debug_info.hh"
+#include "sections.hh"
 #include "pri.hh"
 
 namespace
index 8e980a360d97d5d20cda63eecf510343bffbbc4b..a514d2682794023b5d52962ed450525f38423545 100644 (file)
@@ -38,6 +38,7 @@
 #include "dwarfstrings.h"
 #include "all-dies-it.hh"
 #include "pri.hh"
+#include "messages.h"
 #include <map>
 
 using elfutils::dwarf;
index a9bb20e50b08e24731ffc05b3f50c7389aecfd14..ba380012326cb3d9ba26183b8a52e05aa916a08f 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "highlevel_check.hh"
 #include "check_debug_loc_range.hh"
+#include "check_debug_aranges.hh"
 
 using elfutils::dwarf;
 
index 87c64b957febf4015abf602b32dee401a200b613..00dea32387f0e4b76a90cce8488159c94eaee8f6 100644 (file)
@@ -24,6 +24,7 @@
    <http://www.openinventionnetwork.com>.  */
 
 #include "highlevel_check.hh"
+#include "messages.h"
 
 namespace
 {
index 1d5582506119ec249c7305e95946ad58a19d6775..dcc9e0b36703861db155363d09da55ba2e61c2bd 100644 (file)
@@ -30,7 +30,7 @@
 # include <config.h>
 #endif
 
-#include "checks-low.hh"
+#include "checks.hh"
 #include "config.h"
 #include "c++/dwarf"
 #include "../libdwfl/libdwfl.h"
index 9801d2929c966608248cad33cd2d2d74162e4f29..c79a4e86117cad7965778745fe9268762ab8e528 100644 (file)
@@ -38,7 +38,6 @@
 #include "dwarflint.hh"
 #include "readctx.h"
 #include "checks.hh"
-#include "checks-low.hh" // xxx
 
 /* Bug report address.  */
 const char *argp_program_bug_address = PACKAGE_BUGREPORT;
similarity index 92%
rename from src/dwarflint/checks-low.cc
rename to src/dwarflint/sections.cc
index 4e07beb7fd0a9677fe9f5e97d69b6f9fe0ee3b2b..36f1ef668cfd7c2d0f97cde1fb14c7fdfc7fc5c8 100644 (file)
@@ -1,4 +1,4 @@
-/* Pedantic checking of DWARF files
+/* Low-level section handling.
    Copyright (C) 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
 # include <config.h>
 #endif
 
-#include "low.h"
-#include "config.h"
-#include "pri.hh"
-#include "check_debug_loc_range.hh"
-#include "check_debug_info.hh"
-#include <map>
-#include <sstream>
+#include <cstdlib>
 #include <cstring>
-#include <cassert>
+#include <sstream>
+#include "../libelf/gelf.h"
 
+#include "sections.hh"
+
+#include "messages.h"
+#include "pri.hh"
+#include "config.h"
 
 namespace
 {
@@ -463,27 +463,3 @@ section_base::section_base (dwarflint &lint, section_id secid)
   , file (sections->file)
 {
 }
-
-check_debug_aranges::check_debug_aranges (dwarflint &lint)
-  : _m_sec_aranges (lint.check (_m_sec_aranges))
-{
-  check_debug_info *info = lint.toplev_check<check_debug_info> ();
-  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)
-       lint.toplev_check<check_debug_ranges> ();
-      if (!info->cu_cov.need_ranges)
-       cov = &info->cu_cov.cov;
-    }
-
-  if (!check_aranges_structural (&_m_sec_aranges->file,
-                                &_m_sec_aranges->sect,
-                                info != NULL ? &info->cus.front () : NULL,
-                                cov))
-    throw check_base::failed ();
-}
similarity index 82%
rename from src/dwarflint/checks-low.hh
rename to src/dwarflint/sections.hh
index 3169e7fd7670fa8dc4bc75b65e3d34f8bb0a71d8..3bd2c63dafe4f35fa576fa574f6a13d92d11d689 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/* Low-level section handling.
    Copyright (C) 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Network licensing program, please visit www.openinventionnetwork.com
    <http://www.openinventionnetwork.com>.  */
 
-#ifndef DWARFLINT_CHECKS_LOW_HH
-#define DWARFLINT_CHECKS_LOW_HH
+#ifndef DWARFLINT_SECTIONS_HH
+#define DWARFLINT_SECTIONS_HH
 
-#include "low.h"
 #include "checks.hh"
+#include "low.h"
 
 class load_sections
   : public check<load_sections>
@@ -53,25 +53,15 @@ public:
   }
 };
 
-template<section_id sec_id>
+template<unsigned sec_id>
 class section
   : public section_base
   , public check<section<sec_id> >
 {
 public:
   explicit section (dwarflint &lint)
-    : section_base (lint, sec_id)
+    : section_base (lint, static_cast <enum section_id> (sec_id))
   {}
 };
 
-class check_debug_aranges
-  : public check<check_debug_aranges>
-{
-  section<sec_aranges> *_m_sec_aranges;
-
-public:
-  explicit check_debug_aranges (dwarflint &lint);
-};
-static reg<check_debug_aranges> reg_debug_aranges;
-
-#endif//DWARFLINT_CHECKS_LOW_HH
+#endif//DWARFLINT_SECTIONS_HH
diff --git a/src/dwarflint/sections.ii b/src/dwarflint/sections.ii
new file mode 100644 (file)
index 0000000..67f5e3f
--- /dev/null
@@ -0,0 +1 @@
+template<unsigned> class section;