From: Petr Machata Date: Wed, 22 Sep 2010 14:48:50 +0000 (+0200) Subject: dwarflint: Get rid of low.h/low.c X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56df0cc20114ed6042de2838e22f21bcbd5c1c33;p=thirdparty%2Felfutils.git dwarflint: Get rid of low.h/low.c - and rename misc.h to misc.hh --- diff --git a/dwarflint/Makefile.am b/dwarflint/Makefile.am index f83cef4c6..70cae2679 100644 --- a/dwarflint/Makefile.am +++ b/dwarflint/Makefile.am @@ -38,28 +38,29 @@ no_mudflap.os = -fmudflap bin_PROGRAMS = dwarflint dwarflint_SOURCES = \ - main.cc \ + addr-record.cc addr-record.hh \ + all-dies-it.hh \ checkdescriptor.cc checkdescriptor.hh checkdescriptor.ii \ + checked_read.cc checked_read.hh \ checkrule.cc checkrule.hh \ - dwarflint.cc dwarflint.hh dwarflint.ii misc.h \ - low.cc low.h elf_file.ii \ - expected-at.cc expected.hh \ + checks.cc checks.hh checks.ii \ coverage.cc coverage.hh \ - readctx.c readctx.h \ - checked_read.cc checked_read.hh \ - pri.cc pri.hh \ + cu_coverage.cc cu_coverage.hh cu_coverage.ii \ + dwarflint.cc dwarflint.hh dwarflint.ii \ + elf_file.hh elf_file.ii \ + expected-at.cc expected.hh \ + highlevel_check.cc highlevel_check.hh \ + main.cc \ messages.cc messages.hh \ - section_id.cc section_id.hh \ - where.c where.h \ + misc.cc misc.hh \ option.cc option.hh \ - addr-record.cc addr-record.hh \ + pri.cc pri.hh \ + readctx.c readctx.h \ reloc.cc reloc.hh \ - tables.cc tables.hh \ - all-dies-it.hh \ - checks.cc checks.hh checks.ii \ + section_id.cc section_id.hh \ sections.cc sections.hh sections.ii \ - highlevel_check.cc highlevel_check.hh \ - cu_coverage.cc cu_coverage.hh cu_coverage.ii \ + tables.cc tables.hh \ + where.c where.h \ check_debug_abbrev.cc check_debug_abbrev.hh check_debug_abbrev.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 \ diff --git a/dwarflint/addr-record.cc b/dwarflint/addr-record.cc index 5c4234a7c..ec31eba2e 100644 --- a/dwarflint/addr-record.cc +++ b/dwarflint/addr-record.cc @@ -24,7 +24,7 @@ . */ #include "addr-record.hh" -#include "misc.h" +#include "misc.hh" size_t addr_record_find_addr (struct addr_record *ar, uint64_t addr) diff --git a/dwarflint/check_debug_abbrev.cc b/dwarflint/check_debug_abbrev.cc index a46f0e8ea..ed19b134f 100644 --- a/dwarflint/check_debug_abbrev.cc +++ b/dwarflint/check_debug_abbrev.cc @@ -34,7 +34,7 @@ #include "sections.hh" #include "checked_read.hh" #include "messages.hh" -#include "misc.h" +#include "misc.hh" #include #include diff --git a/dwarflint/check_debug_aranges.cc b/dwarflint/check_debug_aranges.cc index 88bc7c91f..c817fd9d0 100644 --- a/dwarflint/check_debug_aranges.cc +++ b/dwarflint/check_debug_aranges.cc @@ -32,13 +32,15 @@ #include -#include "low.h" +#include "elf_file.hh" #include "sections.hh" #include "check_debug_aranges.hh" #include "check_debug_info.hh" #include "check_debug_loc_range.hh" #include "cu_coverage.hh" #include "checked_read.hh" +#include "misc.hh" +#include "pri.hh" checkdescriptor const * check_debug_aranges::descriptor () diff --git a/dwarflint/check_debug_aranges.hh b/dwarflint/check_debug_aranges.hh index dbd0726eb..47aa145fe 100644 --- a/dwarflint/check_debug_aranges.hh +++ b/dwarflint/check_debug_aranges.hh @@ -1,5 +1,5 @@ /* Low-level checking of .debug_aranges. - 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,7 +26,6 @@ #ifndef DWARFLINT_CHECK_DEBUG_ARANGES_HH #define DWARFLINT_CHECK_DEBUG_ARANGES_HH -#include "low.h" #include "checks.hh" #include "sections.ii" #include "check_debug_info.ii" diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index c9bced674..a69a90765 100644 --- a/dwarflint/check_debug_info.cc +++ b/dwarflint/check_debug_info.cc @@ -42,7 +42,7 @@ #include "check_debug_abbrev.hh" #include "check_debug_info.hh" #include "check_debug_line.hh" -#include "misc.h" +#include "misc.hh" checkdescriptor const * read_cu_headers::descriptor () diff --git a/dwarflint/check_debug_line.cc b/dwarflint/check_debug_line.cc index 64c1a09a7..fe44618a4 100644 --- a/dwarflint/check_debug_line.cc +++ b/dwarflint/check_debug_line.cc @@ -29,6 +29,7 @@ #include "pri.hh" #include "checked_read.hh" #include "messages.hh" +#include "misc.hh" #include #include "../libdw/known-dwarf.h" diff --git a/dwarflint/check_debug_line.hh b/dwarflint/check_debug_line.hh index a70982d17..a38f7ef70 100644 --- a/dwarflint/check_debug_line.hh +++ b/dwarflint/check_debug_line.hh @@ -29,8 +29,9 @@ #include "check_debug_info.ii" #include "sections.ii" #include "checks.hh" + +#include "../libdw/libdw.h" #include -#include "low.h" class check_debug_line : public check diff --git a/dwarflint/check_debug_loc_range.cc b/dwarflint/check_debug_loc_range.cc index 6f5251ad7..b8456b919 100644 --- a/dwarflint/check_debug_loc_range.cc +++ b/dwarflint/check_debug_loc_range.cc @@ -37,14 +37,14 @@ #include #include "../libdw/dwarf.h" -#include "low.h" +#include "elf_file.hh" #include "check_debug_loc_range.hh" #include "check_debug_info.hh" #include "sections.hh" #include "checked_read.hh" #include "../src/dwarf-opcodes.h" #include "pri.hh" -#include "misc.h" +#include "misc.hh" bool do_range_coverage = false; // currently no option diff --git a/dwarflint/check_debug_pub.cc b/dwarflint/check_debug_pub.cc index 354a63167..008355863 100644 --- a/dwarflint/check_debug_pub.cc +++ b/dwarflint/check_debug_pub.cc @@ -29,6 +29,7 @@ #include "pri.hh" #include "checked_read.hh" #include "messages.hh" +#include "misc.hh" template check_debug_pub::check_debug_pub (checkstack &stack, dwarflint &lint) diff --git a/dwarflint/check_debug_pub.hh b/dwarflint/check_debug_pub.hh index 97415f8c8..663c400dc 100644 --- a/dwarflint/check_debug_pub.hh +++ b/dwarflint/check_debug_pub.hh @@ -29,7 +29,7 @@ #include "sections.ii" #include "check_debug_info.ii" #include "checks.hh" -#include "low.h" +#include "elf_file.ii" template class check_debug_pub diff --git a/dwarflint/check_range_out_of_scope.cc b/dwarflint/check_range_out_of_scope.cc index df6cda798..db774998b 100644 --- a/dwarflint/check_range_out_of_scope.cc +++ b/dwarflint/check_range_out_of_scope.cc @@ -31,7 +31,7 @@ #include "coverage.hh" #include "pri.hh" #include "check_debug_loc_range.hh" -#include "misc.h" +#include "misc.hh" using elfutils::dwarf; diff --git a/dwarflint/coverage.cc b/dwarflint/coverage.cc index 80e3be587..fde4351bf 100644 --- a/dwarflint/coverage.cc +++ b/dwarflint/coverage.cc @@ -29,8 +29,8 @@ #endif #include "coverage.hh" +#include "misc.hh" #include "pri.hh" -#include "misc.h" #include #include diff --git a/dwarflint/low.h b/dwarflint/elf_file.hh similarity index 55% rename from dwarflint/low.h rename to dwarflint/elf_file.hh index 8f4d4424c..d283e7877 100644 --- a/dwarflint/low.h +++ b/dwarflint/elf_file.hh @@ -23,59 +23,41 @@ Network licensing program, please visit www.openinventionnetwork.com . */ -#ifndef DWARFLINT_LOW_H -#define DWARFLINT_LOW_H +#ifndef DWARFLINT_ELF_FILE_HH +#define DWARFLINT_ELF_FILE_HH #include "../libdw/libdw.h" #include "../libebl/libebl.h" #include "reloc.hh" -#ifdef __cplusplus -extern "C" +struct sec { -#else -# include -#endif + GElf_Shdr shdr; + struct relocation_data rel; + Elf_Scn *scn; + const char *name; - struct sec - { - GElf_Shdr shdr; - struct relocation_data rel; - Elf_Scn *scn; - const char *name; - - Elf_Data *data; /* May be NULL if data in this section are + Elf_Data *data; /* May be NULL if data in this section are missing or not substantial. */ - enum section_id id; - }; - - struct elf_file - { - GElf_Ehdr ehdr; /* Header of underlying Elf. */ - Elf *elf; - Ebl *ebl; + enum section_id id; +}; - struct sec *sec; /* Array of sections. */ - size_t size; - size_t alloc; - - /* Pointers into SEC above. Maps section_id to section. */ - struct sec *debugsec[count_debuginfo_sections]; +struct elf_file +{ + GElf_Ehdr ehdr; /* Header of underlying Elf. */ + Elf *elf; + Ebl *ebl; - bool addr_64; /* True if it's 64-bit Elf. */ - bool other_byte_order; /* True if the file has a byte order - different from the host. */ - }; + struct sec *sec; /* Array of sections. */ + size_t size; + size_t alloc; - extern bool address_aligned (uint64_t addr, uint64_t align); - extern bool necessary_alignment (uint64_t start, uint64_t length, - uint64_t align); -#define PRI_NOT_ENOUGH ": not enough data for %s.\n" - extern bool supported_version (unsigned version, - size_t num_supported, struct where *where, ...); + /* Pointers into SEC above. Maps section_id to section. */ + struct sec *debugsec[count_debuginfo_sections]; -#ifdef __cplusplus -} -#endif + bool addr_64; /* True if it's 64-bit Elf. */ + bool other_byte_order; /* True if the file has a byte order + different from the host. */ +}; -#endif/*DWARFLINT_LOW_H*/ +#endif/*DWARFLINT_ELF_FILE_HH*/ diff --git a/dwarflint/main.cc b/dwarflint/main.cc index 16850628b..c2670c533 100644 --- a/dwarflint/main.cc +++ b/dwarflint/main.cc @@ -33,7 +33,6 @@ #include #include -#include "low.h" #include "dwarflint.hh" #include "readctx.h" #include "checks.hh" diff --git a/dwarflint/messages.cc b/dwarflint/messages.cc index 784dffb7b..1c2f974bc 100644 --- a/dwarflint/messages.cc +++ b/dwarflint/messages.cc @@ -24,7 +24,7 @@ . */ #include "messages.hh" -#include "misc.h" +#include "misc.hh" #include "coverage.hh" #include diff --git a/dwarflint/low.cc b/dwarflint/misc.cc similarity index 99% rename from dwarflint/low.cc rename to dwarflint/misc.cc index 30c2f2b31..497ee114e 100644 --- a/dwarflint/low.cc +++ b/dwarflint/misc.cc @@ -27,7 +27,7 @@ # include #endif -#include "low.h" +#include "misc.hh" #include "messages.hh" #include diff --git a/dwarflint/misc.h b/dwarflint/misc.hh similarity index 83% rename from dwarflint/misc.h rename to dwarflint/misc.hh index c23371436..79b601472 100644 --- a/dwarflint/misc.h +++ b/dwarflint/misc.hh @@ -23,10 +23,16 @@ Network licensing program, please visit www.openinventionnetwork.com . */ -#ifndef DWARFLINT_MISC_H -#define DWARFLINT_MISC_H +#ifndef DWARFLINT_MISC_HH +#define DWARFLINT_MISC_HH -#include +#include +#include "where.h" + +extern "C" +{ +#include "../lib/system.h" +} #define REALLOC(A, BUF) \ do { \ @@ -45,21 +51,12 @@ #define WIPE(OBJ) memset (&OBJ, 0, sizeof (OBJ)) -#ifdef __cplusplus -# define IF_CPLUSPLUS(X) X -#else -# define IF_CPLUSPLUS(X) /*X*/ -#endif +bool address_aligned (uint64_t addr, uint64_t align); +bool necessary_alignment (uint64_t start, uint64_t length, + uint64_t align); -#ifdef __cplusplus -extern "C" -{ -#endif +bool supported_version (unsigned version, + size_t num_supported, struct where *where, ...); -#include "../lib/system.h" - -#ifdef __cplusplus -} -#endif -#endif//DWARFLINT_MISC_H +#endif//DWARFLINT_MISC_HH diff --git a/dwarflint/pri.hh b/dwarflint/pri.hh index 33a3a2e69..1f4ad6ae2 100644 --- a/dwarflint/pri.hh +++ b/dwarflint/pri.hh @@ -29,6 +29,8 @@ #include #include +#define PRI_NOT_ENOUGH ": not enough data for %s.\n" + namespace pri { class pribase diff --git a/dwarflint/readctx.c b/dwarflint/readctx.c index afd041dc9..8807215f6 100644 --- a/dwarflint/readctx.c +++ b/dwarflint/readctx.c @@ -25,7 +25,6 @@ . */ #include "readctx.h" -#include "low.h" #include "../libdw/dwarf.h" #include diff --git a/dwarflint/reloc.cc b/dwarflint/reloc.cc index 94730466b..eaaf5341a 100644 --- a/dwarflint/reloc.cc +++ b/dwarflint/reloc.cc @@ -26,10 +26,10 @@ // xxx drop as soon as not necessary #define __STDC_FORMAT_MACROS -#include "low.h" #include "reloc.hh" +#include "elf_file.hh" #include "messages.hh" -#include "misc.h" +#include "misc.hh" #include "readctx.h" #include diff --git a/dwarflint/reloc.hh b/dwarflint/reloc.hh index e5d292bac..74a444b4a 100644 --- a/dwarflint/reloc.hh +++ b/dwarflint/reloc.hh @@ -66,10 +66,10 @@ enum skip_type bool read_rel (struct elf_file *file, struct sec *sec, Elf_Data *reldata, bool elf_64); -struct relocation *relocation_next (struct relocation_data *reloc, - uint64_t offset, - struct where const *where, - enum skip_type st); +relocation *relocation_next (struct relocation_data *reloc, + uint64_t offset, + struct where const *where, + enum skip_type st); void relocation_reset (struct relocation_data *reloc); diff --git a/dwarflint/sections.cc b/dwarflint/sections.cc index a81d7dc62..b1fb2a672 100644 --- a/dwarflint/sections.cc +++ b/dwarflint/sections.cc @@ -34,7 +34,7 @@ #include "sections.hh" #include "messages.hh" #include "pri.hh" -#include "misc.h" +#include "misc.hh" checkdescriptor const * load_sections::descriptor () diff --git a/dwarflint/sections.hh b/dwarflint/sections.hh index d216b0049..1d488fbc6 100644 --- a/dwarflint/sections.hh +++ b/dwarflint/sections.hh @@ -1,5 +1,5 @@ /* Low-level section handling. - 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 @@ -27,7 +27,7 @@ #define DWARFLINT_SECTIONS_HH #include "checks.hh" -#include "low.h" +#include "elf_file.hh" class load_sections : public check