From: Petr Machata Date: Mon, 2 Feb 2009 16:34:24 +0000 (+0100) Subject: Fix a bug and make some errors not showstoppers in aranges structural check X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=157067f2944d53643d3840bf88d15c1a563df2dd;p=thirdparty%2Felfutils.git Fix a bug and make some errors not showstoppers in aranges structural check --- diff --git a/src/dwarflint.c b/src/dwarflint.c index f576fc3a5..f4b4913a4 100644 --- a/src/dwarflint.c +++ b/src/dwarflint.c @@ -3068,13 +3068,11 @@ check_aranges_structural (struct read_ctx *ctx, struct cu *cu_chain) uint64_t r_cov_end = cov_end + shdr->sh_addr - address; if (!coverage_pristine (cov, cov_begin, cov_end - cov_begin)) - { - wr_message (mc_aranges | mc_impact_2 | mc_error, &where, - ": address range %#" PRIx64 "..%#" PRIx64 - " overlaps with another one defined earlier.\n", - address, end); - cov_retval = false; - } + /* Not a show stopper, this shouldn't derain high-level. ou*/ + wr_message (mc_aranges | mc_impact_2 | mc_error, &where, + ": address range %#" PRIx64 "..%#" PRIx64 + " overlaps with another one defined earlier.\n", + address, end); /* Section coverage... */ coverage_add (cov, cov_begin, cov_end); @@ -3086,10 +3084,10 @@ check_aranges_structural (struct read_ctx *ctx, struct cu *cu_chain) if (!found) { + /* Not a show stopper. */ wr_error (&where, ": couldn't find a section that the range %#" PRIx64 "..%#" PRIx64 " covers.\n", address, end); - retval = false; continue; } else @@ -3133,6 +3131,9 @@ check_aranges_structural (struct read_ctx *ctx, struct cu *cu_chain) if (data == NULL) wr_error (&WHERE (sec_aranges, NULL), ": couldn't read section data, coverage analysis may be inaccurate.\n"); + else if (data->d_buf == NULL) + wr_error (&WHERE (sec_aranges, NULL), + ": data-less section data, coverage analysis may be inaccurate.\n"); void section_hole (uint64_t h_begin, uint64_t h_end, void *user __attribute__ ((unused))) @@ -3150,13 +3151,11 @@ check_aranges_structural (struct read_ctx *ctx, struct cu *cu_chain) return; uint64_t base = sco->shdr.sh_addr; - h_begin += base; - h_end += base; - if (data != NULL) + if (data != NULL && data->d_buf != NULL) { bool zeroes = true; for (uint64_t j = h_begin; j < h_end; ++j) - if (((char *)data->d_buf)[j - base] != 0) + if (((char *)data->d_buf)[j] != 0) { zeroes = false; break; @@ -3167,7 +3166,7 @@ check_aranges_structural (struct read_ctx *ctx, struct cu *cu_chain) wr_error (&where, ": addresses %#" PRIx64 "..%#" PRIx64 - " (of section %s) are not covered.\n", + " of section %s are not covered.\n", h_begin + base, h_end + base, scnname); } diff --git a/src/dwarflint.h b/src/dwarflint.h index 4e2a7ea93..5f2b8fc12 100644 --- a/src/dwarflint.h +++ b/src/dwarflint.h @@ -45,8 +45,8 @@ extern "C" ((struct where) \ {(SECTION), (uint64_t)-1, (uint64_t)-1, (uint64_t)-1, NULL, NEXT}) - extern const char *where_fmt (const struct where *wh, char *ptr); - extern void where_fmt_chain (const struct where *wh, const char *severity); + extern const char *where_fmt (struct where *wh, char *ptr); + extern void where_fmt_chain (struct where *wh, const char *severity); extern void where_reset_1 (struct where *wh, uint64_t addr); extern void where_reset_2 (struct where *wh, uint64_t addr); extern void where_reset_3 (struct where *wh, uint64_t addr); @@ -93,10 +93,10 @@ extern "C" mc_all = 0xffffff00, // all areas }; - extern void wr_error (const struct where *wh, const char *format, ...) + extern void wr_error (struct where *wh, const char *format, ...) __attribute__ ((format (printf, 2, 3))); - extern void wr_warning (const struct where *wh, const char *format, ...) + extern void wr_warning (struct where *wh, const char *format, ...) __attribute__ ((format (printf, 2, 3))); extern void wr_message (enum message_category category, const struct where *wh,