aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>1997-02-06 22:22:37 +0000
committerMartin Hunt <hunt@redhat.com>1997-02-06 22:22:37 +0000
commit33a795ddf320478214403b4c6d73220cde9dbb01 (patch)
treed67002000161812e97a19c6463470fac38ac4900 /binutils/objdump.c
parentda0bce9c27299834b4fd4da16d98e616a3371ad6 (diff)
downloadgdb-33a795ddf320478214403b4c6d73220cde9dbb01.zip
gdb-33a795ddf320478214403b4c6d73220cde9dbb01.tar.gz
gdb-33a795ddf320478214403b4c6d73220cde9dbb01.tar.bz2
Thu Feb 6 14:14:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
* objdump.c (disassemble_bytes): Added code to allow some control over the way raw instructions are displayed.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index fd73186..77a8d71 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1107,7 +1107,7 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
{
char buf[1000];
SFILE sfile;
- int pb = 0;
+ int bpc, pb = 0;
done_dot = false;
@@ -1139,6 +1139,7 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
info->fprintf_func = (fprintf_ftype) objdump_sprintf;
info->stream = (FILE *) &sfile;
info->bytes_per_line = 0;
+ info->bytes_per_chunk = 0;
bytes = (*disassemble_fn) (section->vma + i, info);
info->fprintf_func = (fprintf_ftype) fprintf;
info->stream = stdout;
@@ -1170,15 +1171,31 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
long j;
/* If ! prefix_addresses and ! wide_output, we print
- four bytes per line. */
+ bytes_per_line bytes per line. */
pb = bytes;
if (pb > bytes_per_line && ! prefix_addresses && ! wide_output)
pb = bytes_per_line;
- for (j = i; j < i + pb; ++j)
+ if (info->bytes_per_chunk)
+ bpc = info->bytes_per_chunk;
+ else
+ bpc = 1;
+
+ for (j = i; 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 (' ');
+ }
}
for (; pb < bytes_per_line; ++pb)