From: Petr Machata Date: Thu, 30 Sep 2010 16:05:54 +0000 (+0200) Subject: dwarflint: Check coverage of arange vs. CUs as well as the other way around X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96d8d19b156f36db02ad03682eba226b957858ca;p=thirdparty%2Felfutils.git dwarflint: Check coverage of arange vs. CUs as well as the other way around --- diff --git a/dwarflint/check_debug_aranges.cc b/dwarflint/check_debug_aranges.cc index bae345a1c..99f8669b2 100644 --- a/dwarflint/check_debug_aranges.cc +++ b/dwarflint/check_debug_aranges.cc @@ -82,12 +82,14 @@ namespace elf_file *elf; section_id id; char const *what; + bool reverse; hole_user (elf_file *a_elf, section_id a_id, - char const *a_what) + char const *a_what, bool a_reverse) : elf (a_elf) , id (a_id) , what (a_what) + , reverse (a_reverse) {} }; } @@ -119,10 +121,18 @@ hole (uint64_t start, uint64_t length, void *user) { char buf[128]; where where = WHERE (info.id, NULL); + char const *what = info.what; + char const *cu = "CUs"; + if (info.reverse) + { + char const *tmp = what; + what = cu; + cu = tmp; + } wr_message (mc_aranges | mc_impact_3, &where, - ": addresses %s are covered with CUs, but not with %s.\n", - range_fmt (buf, sizeof buf, start, start + length), - info.what); + ": addresses %s are covered with %s, but not with %s.\n", + range_fmt (buf, sizeof (buf), start, start + length), + cu, what); } if (sec == NULL) @@ -132,19 +142,28 @@ hole (uint64_t start, uint64_t length, void *user) } static void -compare_coverage (struct elf_file *file, - struct coverage *coverage, struct coverage *other, - enum section_id id, char const *what) +compare_coverage_1 (struct elf_file *file, + struct coverage *coverage, struct coverage *other, + enum section_id id, char const *what, + bool reverse) { struct coverage *cov = coverage_clone (coverage); coverage_remove_all (cov, other); - - hole_user info (file, id, what); + hole_user info (file, id, what, reverse); coverage_find_ranges (cov, hole, &info); coverage_free (cov); free (cov); } +static void +compare_coverage (struct elf_file *file, + struct coverage *coverage, struct coverage *other, + enum section_id id, char const *what) +{ + compare_coverage_1 (file, coverage, other, id, what, false); + compare_coverage_1 (file, other, coverage, id, what, false); +} + inline static void aranges_coverage_add (struct coverage *aranges_coverage, uint64_t begin, uint64_t length,