]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf.c (register_info): Handle loc == NULL.
authorMark Wielaard <mjw@redhat.com>
Mon, 27 Aug 2012 12:30:05 +0000 (14:30 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 27 Aug 2012 12:30:05 +0000 (14:30 +0200)
register_info is called by print_cfa_program with loc being NULL.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c

index d80f844feb5560d8cc93f15b649cf3378df3abbe..72804bd9aedd917f328b67b759c6499d15e7aba6 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-27  Mark Wielaard  <mjw@redhat.com>
+
+       * readelf.c (register_info): Handle loc == NULL.
+
 2012-08-22  Jeff Kenton  <jkenton@tilera.com>
 
        * elflint.c (valid_e_machine): Add EM_TILEGX and EM_TILEPRO.
index dc496695b906954ce419e69e0fe8b3311f4d0cdf..4ff8ebbd93e71ff37ca8cd3a67ca04b73b9b3718 100644 (file)
@@ -4305,9 +4305,12 @@ register_info (Ebl *ebl, unsigned int regno, const Ebl_Register_Location *loc,
                                 bits ?: &ignore, type ?: &ignore);
   if (n <= 0)
     {
-      snprintf (name, REGNAMESZ, "reg%u", loc->regno);
+      if (loc != NULL)
+       snprintf (name, REGNAMESZ, "reg%u", loc->regno);
+      else
+       snprintf (name, REGNAMESZ, "??? 0x%x", regno);
       if (bits != NULL)
-       *bits = loc->bits;
+       *bits = loc != NULL ? loc->bits : 0;
       if (type != NULL)
        *type = DW_ATE_unsigned;
       set = "??? unrecognized";
@@ -4315,7 +4318,7 @@ register_info (Ebl *ebl, unsigned int regno, const Ebl_Register_Location *loc,
   else
     {
       if (bits != NULL && *bits <= 0)
-       *bits = loc->bits;
+       *bits = loc != NULL ? loc->bits : 0;
       if (type != NULL && *type == DW_ATE_void)
        *type = DW_ATE_unsigned;