checks.cc checks.hh checks.ii \
coverage.cc coverage.hh \
cu_coverage.cc cu_coverage.hh cu_coverage.ii \
- dwarflint.cc dwarflint.hh dwarflint.ii \
- dwarf_version.cc dwarf_version.hh dwarf_version.ii \
- dwarf_version-imp.cc dwarf_version-imp.hh \
dwarf_2.cc dwarf_2.hh \
dwarf_3.cc dwarf_3.hh \
dwarf_4.cc dwarf_4.hh \
+ dwarf_mips.cc dwarf_mips.hh \
+ dwarf_version-imp.cc dwarf_version-imp.hh \
+ dwarf_version.cc dwarf_version.hh dwarf_version.ii \
+ dwarflint.cc dwarflint.hh dwarflint.ii \
elf_file.hh elf_file.ii \
expected-at.cc expected.hh \
highlevel_check.cc highlevel_check.hh \
sections.cc sections.hh sections.ii \
where.c where.h \
wrap.cc wrap.hh \
+ \
check_debug_abbrev.cc check_debug_abbrev.hh check_debug_abbrev.ii \
+ check_debug_aranges.cc check_debug_aranges.hh check_debug_aranges.ii \
check_debug_info.cc check_debug_info.hh check_debug_info.ii \
check_debug_line.cc check_debug_line.hh check_debug_line.ii \
- check_debug_pub.cc check_debug_pub.hh \
check_debug_loc_range.cc check_debug_loc_range.hh check_debug_loc_range.ii \
- check_debug_aranges.cc check_debug_aranges.hh check_debug_aranges.ii \
- lowlevel_checks.cc lowlevel_checks.hh \
- check_matching_ranges.cc \
- check_range_out_of_scope.cc \
- check_expected_trees.cc \
- check_dups_abstract_origin.cc \
+ check_debug_pub.cc check_debug_pub.hh \
check_duplicate_DW_tag_variable.cc \
+ check_dups_abstract_origin.cc \
+ check_expected_trees.cc \
+ check_matching_ranges.cc \
check_nodebug.cc \
+ check_range_out_of_scope.cc \
locstats.cc \
+ lowlevel_checks.cc lowlevel_checks.hh \
+ \
../src/dwarfstrings.c
TESTS = tests/run-debug_abbrev-duplicate-attribute.sh \
--- /dev/null
+/* Pedantic checking of DWARF files
+ Copyright (C) 2010 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 "dwarf_version-imp.hh"
+#include "../libdw/dwarf.h"
+
+namespace
+{
+ struct dwarf_mips_attributes
+ : public attribute_table
+ {
+ void unused (__attribute__ ((unused)) attribute const &attrib) const {}
+ dwarf_mips_attributes ()
+ {
+ // Most of these are really just sketched, since we don't emit
+ // them anyway. For those in need, the documentation is in
+ // mips_extensions.pdf that's installed by libdwarf-devel in
+ // Fedora. According to that document, some forms were never
+ // even emitted. Those are marked as unused and not added.
+ // Their class is arbitrarily chosen as cl_constant.
+
+ add (const_attribute (DW_AT_MIPS_fde));
+ unused (const_attribute (DW_AT_MIPS_loop_begin));
+ unused (const_attribute (DW_AT_MIPS_tail_loop_begin));
+ unused (const_attribute (DW_AT_MIPS_epilog_begin));
+ unused (const_attribute (DW_AT_MIPS_loop_unroll_factor));
+ unused (const_attribute (DW_AT_MIPS_software_pipeline_depth));
+ add (string_attribute (DW_AT_MIPS_linkage_name));
+
+ // [section 8.10] If DW_AT_MIPS_stride is present, the attribute
+ // contains a reference to a DIE which describes the location
+ // holding the stride, and the DW_AT_stride_size field of
+ // DW_TAG_array_type is ignored if present. The value of the
+ // stride is the number of 4 byte words between elements along
+ // that axis.
+ add (ref_attribute (DW_AT_MIPS_stride));
+
+ add (string_attribute (DW_AT_MIPS_abstract_name));
+
+ // xxx in addition, this is supposed to be CU-local reference,
+ // similarly to the DW_AT_sibling. An opportunity to generalize
+ // sibling_form_suitable.
+ add (ref_attribute (DW_AT_MIPS_clone_origin));
+
+ add (flag_attribute (DW_AT_MIPS_has_inlines));
+
+ // The documentation is unclear on what form these should take.
+ // I'm making them the same as DW_AT_byte_stride in DWARF2, in
+ // hopes that that's what they are supposed to be.
+ add (const_attribute (DW_AT_MIPS_stride_byte));
+ add (const_attribute (DW_AT_MIPS_stride_elem));
+
+ add (ref_attribute (DW_AT_MIPS_ptr_dopetype));
+ add (ref_attribute (DW_AT_MIPS_allocatable_dopetype));
+ add (ref_attribute (DW_AT_MIPS_assumed_shape_dopetype));
+ add (flag_attribute (DW_AT_MIPS_assumed_size));
+ }
+ };
+
+ struct dwarf_mips_ext_t
+ : public std_dwarf
+ {
+ dwarf_mips_ext_t ()
+ : std_dwarf (dwarf_mips_attributes (), form_table ())
+ {}
+ };
+}
+
+dwarf_version const *
+dwarf_mips_ext ()
+{
+ static dwarf_mips_ext_t dw;
+ return &dw;
+}
--- /dev/null
+/* Pedantic checking of DWARF files
+ Copyright (C) 2010 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_DWARF_MIPS_HH
+#define DWARFLINT_DWARF_MIPS_HH
+
+#include "dwarf_version.ii"
+
+dwarf_version const *dwarf_mips_ext ();
+
+#endif//DWARFLINT_DWARF_MIPS_HH
#include "dwarf_2.hh"
#include "dwarf_3.hh"
#include "dwarf_4.hh"
+#include "dwarf_mips.hh"
#include "check_debug_info.hh"
#include "../libdw/dwarf.h"
dwarf_version const *
dwarf_version::get (unsigned version)
{
+ // xxx The GNU toolchain commonly uses DW_AT_MIPS_linkage_name,
+ // which is part of the MIPS extensions. So that's what we return.
+ // I wonder how to solve this "right". We cannot simply request
+ // DW_AT_producer/DW_AT_language values here, since we need the
+ // version to know how to read these attributes in the first place.
+
switch (version)
{
- case 2: return dwarf_2 ();
- case 3: return dwarf_3 ();
- case 4: return dwarf_4 ();
+ case 2:
+ {
+ static dwarf_version const *dw = extend (dwarf_2 (), dwarf_mips_ext ());
+ return dw;
+ }
+
+ case 3:
+ {
+ static dwarf_version const *dw = extend (dwarf_3 (), dwarf_mips_ext ());
+ return dw;
+ }
+
+ case 4:
+ {
+ static dwarf_version const *dw = extend (dwarf_4 (), dwarf_mips_ext ());
+ return dw;
+ }
+
default: return NULL;
};
}