aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2009-07-20 13:40:48 +0000
committerH.J. Lu <hjl.tools@gmail.com>2009-07-20 13:40:48 +0000
commit3dcb3fcb147d19fa7d068131f47e58390c5a00a5 (patch)
treeece8548a32dcd6fea9094bc539c90bc9e0ff5bba
parent7769efb28e4e1ee2683a710b9d1e481ad47fd72d (diff)
downloadgdb-3dcb3fcb147d19fa7d068131f47e58390c5a00a5.zip
gdb-3dcb3fcb147d19fa7d068131f47e58390c5a00a5.tar.gz
gdb-3dcb3fcb147d19fa7d068131f47e58390c5a00a5.tar.bz2
2009-07-20 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention --insn-width. * objdump.c (insn_width): New. (usage): Display --insn-width. (option_values): Add OPTION_INSN_WIDTH. (long_options): Add --insn-width. (disassemble_bytes): Handle insn_width. (main): Handle OPTION_INSN_WIDTH. * doc/binutils.texi: Document --insn-width.
-rw-r--r--binutils/ChangeLog13
-rw-r--r--binutils/NEWS4
-rw-r--r--binutils/doc/binutils.texi6
-rw-r--r--binutils/objdump.c15
4 files changed, 36 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 20c69b5..89b1a66 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,16 @@
+2009-07-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ * NEWS: Mention --insn-width.
+
+ * objdump.c (insn_width): New.
+ (usage): Display --insn-width.
+ (option_values): Add OPTION_INSN_WIDTH.
+ (long_options): Add --insn-width.
+ (disassemble_bytes): Handle insn_width.
+ (main): Handle OPTION_INSN_WIDTH.
+
+ * doc/binutils.texi: Document --insn-width.
+
2009-07-17 Nick Clifton <nickc@redhat.com>
* dwarf.c (display_debug_lines): If do_debug_lines has not been
diff --git a/binutils/NEWS b/binutils/NEWS
index 2edef3c..b3fd137 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,4 +1,8 @@
-*- text -*-
+* Add a new command line option, --insn-width=WIDTH, to objdump to specify
+number of bytes to be displayed on a single line when disassembling
+instructions.
+
* Readelf can now display the relocated contents of a section as a sequence
of bytes via the --relocated-dump=<name|number> command line option.
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 2364f9c..98438f2 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -1703,6 +1703,7 @@ objdump [@option{-a}|@option{--archive-headers}]
[@option{--special-syms}]
[@option{--prefix=}@var{prefix}]
[@option{--prefix-strip=}@var{level}]
+ [@option{--insn-width=}@var{width}]
[@option{-V}|@option{--version}]
[@option{-H}|@option{--help}]
@var{objfile}@dots{}
@@ -2055,6 +2056,11 @@ in symbolic form. This is the default except when
When disassembling instructions, do not print the instruction bytes.
This is the default when @option{--prefix-addresses} is used.
+@item --insn-width=@var{width}
+@cindex Instruction width
+Display @var{width} bytes on a single line when disassembling
+instructions.
+
@item -W[lLiaprmfFsoR]
@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]
@cindex DWARF
diff --git a/binutils/objdump.c b/binutils/objdump.c
index b346aa7..760df3b 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -104,6 +104,7 @@ static bfd_boolean disassemble_all; /* -D */
static int disassemble_zeroes; /* --disassemble-zeroes */
static bfd_boolean formats_info; /* -i */
static int wide_output; /* -w */
+static int insn_width; /* --insn-width */
static bfd_vma start_address = (bfd_vma) -1; /* --start-address */
static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */
static int dump_debugging; /* --debugging */
@@ -235,6 +236,7 @@ usage (FILE *stream, int status)
--stop-address=ADDR Only process data whose address is <= ADDR\n\
--prefix-addresses Print complete address alongside disassembly\n\
--[no-]show-raw-insn Display hex alongside symbolic disassembly\n\
+ --insn-width=WIDTH Display WIDTH bytes on a signle line for -d\n\
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\
--special-syms Include special symbols in symbol dumps\n\
--prefix=PREFIX Add PREFIX to absolute paths for -S\n\
@@ -259,6 +261,7 @@ enum option_values
OPTION_DWARF,
OPTION_PREFIX,
OPTION_PREFIX_STRIP,
+ OPTION_INSN_WIDTH,
OPTION_ADJUST_VMA
};
@@ -306,6 +309,7 @@ static struct option long_options[]=
{"wide", no_argument, NULL, 'w'},
{"prefix", required_argument, NULL, OPTION_PREFIX},
{"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
+ {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
{0, no_argument, 0, 0}
};
@@ -1415,7 +1419,9 @@ disassemble_bytes (struct disassemble_info * info,
sfile.buffer = xmalloc (sfile.alloc);
sfile.pos = 0;
- if (insns)
+ if (insn_width)
+ octets_per_line = insn_width;
+ else if (insns)
octets_per_line = 4;
else
octets_per_line = 16;
@@ -1566,7 +1572,7 @@ disassemble_bytes (struct disassemble_info * info,
octets = (*disassemble_fn) (section->vma + addr_offset, info);
info->fprintf_func = (fprintf_ftype) fprintf;
info->stream = stdout;
- if (info->bytes_per_line != 0)
+ if (insn_width == 0 && info->bytes_per_line != 0)
octets_per_line = info->bytes_per_line;
if (octets < 0)
{
@@ -3251,6 +3257,11 @@ main (int argc, char **argv)
if (prefix_strip < 0)
fatal (_("error: prefix strip must be non-negative"));
break;
+ case OPTION_INSN_WIDTH:
+ insn_width = strtoul (optarg, NULL, 0);
+ if (insn_width <= 0)
+ fatal (_("error: instruction width must be positive"));
+ break;
case 'E':
if (strcmp (optarg, "B") == 0)
endian = BFD_ENDIAN_BIG;