]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix a bug and make some errors not showstoppers in aranges structural check
authorPetr Machata <pmachata@redhat.com>
Mon, 2 Feb 2009 16:34:24 +0000 (17:34 +0100)
committerPetr Machata <pmachata@redhat.com>
Mon, 2 Feb 2009 17:02:49 +0000 (18:02 +0100)
src/dwarflint.c
src/dwarflint.h

index f576fc3a5290fa651ec5a5b718c9768bd64f0bd4..f4b4913a41ae200d1499952522fe6c4a1ff61b6d 100644 (file)
@@ -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);
        }
 
index 4e2a7ea93cdf4409ef2899c9bda54b464fbc0626..5f2b8fc1220b5ec667b4cb995cd8707a66b854af 100644 (file)
@@ -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,