From: Petr Machata Date: Tue, 21 Sep 2010 21:32:43 +0000 (+0200) Subject: dwarflint: Move much of the rest of low.h to where it belongs X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8d64a0ffab2efe582f69de9bc8dbccb723b1853;p=thirdparty%2Felfutils.git dwarflint: Move much of the rest of low.h to where it belongs --- diff --git a/dwarflint/Makefile.am b/dwarflint/Makefile.am index 673d94f92..92c5b8a0b 100644 --- a/dwarflint/Makefile.am +++ b/dwarflint/Makefile.am @@ -42,7 +42,7 @@ dwarflint_SOURCES = \ checkdescriptor.cc checkdescriptor.hh checkdescriptor.ii \ checkrule.cc checkrule.hh \ dwarflint.cc dwarflint.hh dwarflint.ii misc.h \ - low.c low.h elf_file.ii \ + low.cc low.h elf_file.ii \ expected-at.cc expected.hh \ coverage.cc coverage.h \ readctx.c readctx.h \ diff --git a/dwarflint/check_debug_info.hh b/dwarflint/check_debug_info.hh index df80baa0c..d5aa1a304 100644 --- a/dwarflint/check_debug_info.hh +++ b/dwarflint/check_debug_info.hh @@ -1,5 +1,5 @@ /* Low-level checking of .debug_info. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009, 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 @@ -26,12 +26,47 @@ #ifndef DWARFLINT_CHECK_DEBUG_INFO_HH #define DWARFLINT_CHECK_DEBUG_INFO_HH -#include "low.h" +#include +#include "addr-record.h" +#include "elf_file.ii" +#include "coverage.hh" #include "checks.hh" #include "check_debug_abbrev.ii" #include "check_debug_line.ii" #include "sections.ii" +struct cu_head +{ + uint64_t offset; + Dwarf_Off size; // Size of this CU. + Dwarf_Off head_size; // Size from begin to 1st byte of CU. + Dwarf_Off total_size; // size + head_size + + int offset_size; // Offset size in this CU. + struct where where; // Where was this section defined. + Dwarf_Off abbrev_offset; // Abbreviation section that this CU uses. + int version; // CU version + int address_size; // Address size in bytes on the target machine. +}; + +struct cu +{ + struct cu *next; // For compatibility with C level. + // xxx will probably go away eventually + struct cu_head const *head; + uint64_t cudie_offset; + uint64_t low_pc; // DW_AT_low_pc value of CU DIE, -1 if not present. + struct ref stmt_list; + struct addr_record die_addrs; // Addresses where DIEs begin in this CU. + struct ref_record die_refs; // DIE references into other CUs from this CU. + struct ref_record loc_refs; // references into .debug_loc from this CU. + struct ref_record range_refs; // references into .debug_ranges from this CU. + struct ref_record decl_file_refs; // values of DW_AT_decl_file in this CU. + bool has_arange; // Whether we saw arange section pointing at this CU. + bool has_pubnames; // Likewise for pubnames. + bool has_pubtypes; // Likewise for pubtypes. +}; + /** The pass for reading basic .debug_info data -- the layout of sections and their headers. */ class read_cu_headers diff --git a/dwarflint/check_debug_loc_range.hh b/dwarflint/check_debug_loc_range.hh index 182f6d3fe..c64140323 100644 --- a/dwarflint/check_debug_loc_range.hh +++ b/dwarflint/check_debug_loc_range.hh @@ -23,13 +23,30 @@ Network licensing program, please visit www.openinventionnetwork.com . */ -#include "low.h" #include "checks.hh" #include "sections.ii" #include "check_debug_info.ii" #include "messages.h" #include "coverage.hh" +struct section_coverage +{ + struct sec *sec; + struct coverage cov; + bool hit; /* true if COV is not pristine. */ + bool warn; /* dwarflint should emit a warning if a coverage + appears in this section */ +}; + +struct coverage_map +{ + struct elf_file *elf; + struct section_coverage *scos; + size_t size; + size_t alloc; + bool allow_overlap; +}; + class check_debug_ranges : public check { diff --git a/dwarflint/low.c b/dwarflint/low.cc similarity index 97% rename from dwarflint/low.c rename to dwarflint/low.cc index 49cf303a5..34dd76e7f 100644 --- a/dwarflint/low.c +++ b/dwarflint/low.cc @@ -1,5 +1,5 @@ /* Pedantic checking of DWARF files - Copyright (C) 2008,2009,2010 Red Hat, Inc. + Copyright (C) 2008, 2009, 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 diff --git a/dwarflint/low.h b/dwarflint/low.h index 14728a6b4..7606557b3 100644 --- a/dwarflint/low.h +++ b/dwarflint/low.h @@ -28,8 +28,6 @@ #include "../libdw/libdw.h" #include "../libebl/libebl.h" -#include "coverage.h" -#include "addr-record.h" #include "reloc.h" #ifdef __cplusplus @@ -76,56 +74,6 @@ extern "C" extern bool supported_version (unsigned version, size_t num_supported, struct where *where, ...); - struct section_coverage - { - struct sec *sec; - struct coverage cov; - bool hit; /* true if COV is not pristine. */ - bool warn; /* dwarflint should emit a warning if a coverage - appears in this section */ - }; - - struct coverage_map - { - struct elf_file *elf; - struct section_coverage *scos; - size_t size; - size_t alloc; - bool allow_overlap; - }; - - struct cu_head - { - uint64_t offset; - Dwarf_Off size; // Size of this CU. - Dwarf_Off head_size; // Size from begin to 1st byte of CU. - Dwarf_Off total_size; // size + head_size - - int offset_size; // Offset size in this CU. - struct where where; // Where was this section defined. - Dwarf_Off abbrev_offset; // Abbreviation section that this CU uses. - int version; // CU version - int address_size; // Address size in bytes on the target machine. - }; - - struct cu - { - struct cu *next; // For compatibility with C level. - // xxx will probably go away eventually - struct cu_head const *head; - uint64_t cudie_offset; - uint64_t low_pc; // DW_AT_low_pc value of CU DIE, -1 if not present. - struct ref stmt_list; - struct addr_record die_addrs; // Addresses where DIEs begin in this CU. - struct ref_record die_refs; // DIE references into other CUs from this CU. - struct ref_record loc_refs; // references into .debug_loc from this CU. - struct ref_record range_refs; // references into .debug_ranges from this CU. - struct ref_record decl_file_refs; // values of DW_AT_decl_file in this CU. - bool has_arange; // Whether we saw arange section pointing at this CU. - bool has_pubnames; // Likewise for pubnames. - bool has_pubtypes; // Likewise for pubtypes. - }; - #ifdef __cplusplus } #endif diff --git a/dwarflint/reloc.cc b/dwarflint/reloc.cc index 392eb71de..53510a75a 100644 --- a/dwarflint/reloc.cc +++ b/dwarflint/reloc.cc @@ -26,9 +26,10 @@ // xxx drop as soon as not necessary #define __STDC_FORMAT_MACROS +#include "low.h" #include "reloc.h" #include "messages.h" -#include "low.h" +#include "misc.h" #include "readctx.h" #include diff --git a/dwarflint/sections.cc b/dwarflint/sections.cc index 1e07987ee..201dac7fc 100644 --- a/dwarflint/sections.cc +++ b/dwarflint/sections.cc @@ -34,6 +34,7 @@ #include "sections.hh" #include "messages.h" #include "pri.hh" +#include "misc.h" checkdescriptor const * load_sections::descriptor ()