Wed Feb 12 12:16:47 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
authorIan Lance Taylor <ian@airs.com>
Wed, 12 Feb 1997 17:18:38 +0000 (17:18 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 12 Feb 1997 17:18:38 +0000 (17:18 +0000)
* objdump.c (disassemble_bytes): Make output of raw instructions
work better for non-standard values of bytes_per_chunk and
bytes_per_line.

I also fixed the spacing in the last patch.

binutils/ChangeLog
binutils/objdump.c

index d372b44548d5a18d2453f3a41db5e6ad8c141844..8a9ecee659ad86a5aebe71ddc42cf5b2b655d307 100644 (file)
@@ -1,3 +1,9 @@
+Wed Feb 12 12:16:47 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * objdump.c (disassemble_bytes): Make output of raw instructions
+       work better for non-standard values of bytes_per_chunk and
+       bytes_per_line.
+
 Thu Feb  6 14:14:59 1997  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
        * objdump.c (disassemble_bytes): Added code to allow some control
index 77a8d710da1358166011b4fda683fa2bc8a712fc..5eca0fc0519b2899591dc92b475e4cf022b9f3f2 100644 (file)
@@ -1186,20 +1186,26 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
                  int k;
                  if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
                    {
-                     for (k=bpc-1; k >= 0; k--)
-                       printf ("%02x", (unsigned) data[j+k]);
+                     for (k = bpc - 1; k >= 0; k--)
+                       printf ("%02x", (unsigned) data[j + k]);
                      putchar (' ');
                    }
                  else
                    {
-                     for (k=0; k < bpc; k++)
-                       printf ("%02x", (unsigned) data[j+k]);
+                     for (k = 0; k < bpc; k++)
+                       printf ("%02x", (unsigned) data[j + k]);
                      putchar (' ');
                    }
                }
 
-             for (; pb < bytes_per_line; ++pb)
-               printf ("   ");
+             for (; pb < bytes_per_line; pb += bpc)
+               {
+                 int k;
+
+                 for (k = 0; k < bpc; k++)
+                   printf ("  ");
+                 putchar (' ');
+               }
 
              /* Separate raw data from instruction by extra space.  */
              if (insns)
@@ -1230,10 +1236,22 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
                  pb += bytes_per_line;
                  if (pb > bytes)
                    pb = bytes;
-                 for (; j < i + pb; ++j)
+                 for (; j < i + pb; j += bpc)
                    {
-                     printf ("%02x", (unsigned) data[j]);
-                     putchar (' ');
+                     int k;
+
+                     if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
+                       {
+                         for (k = bpc - 1; k >= 0; k--)
+                           printf ("%02x", (unsigned) data[j + k]);
+                         putchar (' ');
+                       }
+                     else
+                       {
+                         for (k = 0; k < bpc; k++)
+                           printf ("%02x", (unsigned) data[j + k]);
+                         putchar (' ');
+                       }
                    }
                }
            }