]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix readelf core note bitmask printing.
authorRoland McGrath <roland@redhat.com>
Wed, 14 Apr 2010 18:54:06 +0000 (11:54 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 14 Apr 2010 18:54:06 +0000 (11:54 -0700)
src/ChangeLog
src/readelf.c

index fe6a6e3b20791b11dd261b19d095770470fe828a..53415428ba2f2982a54dc271ec1e1e159fc86b2f 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-14  Roland McGrath  <roland@redhat.com>
+
+       * readelf.c (handle_core_item): Fix bitmask printing.
+
 2010-04-06  Roland McGrath  <roland@redhat.com>
 
        * ld.c (options): Fix some typos in messages.
index 428d24d18873ebdb57e7ed6118b69e061f435d6f..52558602ed829a2f96d5c392e623bc51466cd8f9 100644 (file)
@@ -6731,16 +6731,25 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
          {
            unsigned int bit = ((void *) i - data) * 8;
            unsigned int w = negate ? ~*i : *i;
+           unsigned int run = 0;
            while (w != 0)
              {
                int n = ffs (w);
                w >>= n;
                bit += n;
 
-               if (lastbit + 1 != bit)
-                 p += sprintf (p, "-%u,%u", lastbit - bias, bit - bias);
-               else if (lastbit == 0)
-                 p += sprintf (p, "%u", bit - bias);
+               if (lastbit + 1 == bit)
+                 ++run;
+               else
+                 {
+                   if (lastbit == 0)
+                     p += sprintf (p, "%u", bit - bias);
+                   else if (run == 0)
+                     p += sprintf (p, ",%u", bit - bias);
+                   else
+                     p += sprintf (p, "-%u,%u", lastbit - bias, bit - bias);
+                   run = 0;
+                 }
 
                lastbit = bit;
              }