From 458bbd1f1e586aa857df7cd61cd7b7fd09b96f98 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Tue, 23 Jan 1996 00:50:24 +0000 Subject: [PATCH] Add new option --show-raw-insn. * objdump.c (show_raw_insn): New global. (usage): Update. (long_options): Update. (disassemble_data): Set disasm_info.flags if --show-raw-insn. * objdump.c (disassemble_data): Set new arch,mach,endian fields in disasm_info. --- binutils/ChangeLog | 11 +++++++++++ binutils/binutils.texi | 7 ++++++- binutils/objdump.1 | 8 +++++++- binutils/objdump.c | 14 +++++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 20522e2e8ed..6ee88180f65 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +Mon Jan 22 16:46:43 1996 Doug Evans + + Add new option --show-raw-insn. + * objdump.c (show_raw_insn): New global. + (usage): Update. + (long_options): Update. + (disassemble_data): Set disasm_info.flags if --show-raw-insn. + + * objdump.c (disassemble_data): Set new arch,mach,endian fields in + disasm_info. + Mon Jan 22 19:29:36 1996 Ian Lance Taylor * ieee.c: Extensive changes to pass a single info argument around diff --git a/binutils/binutils.texi b/binutils/binutils.texi index 31df7f1644e..3b857d21166 100644 --- a/binutils/binutils.texi +++ b/binutils/binutils.texi @@ -972,7 +972,8 @@ objdump [ -a | --archive-headers ] [ -s | --full-contents ] [ --stabs ] [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ] [ -w | --wide ] [ --start-address=@var{address} ] - [ --stop-address=@var{address} ] [ --version ] [ --help ] + [ --stop-address=@var{address} ] [ --show-raw-insn ] + [ --version ] [ --help ] @var{objfile}@dots{} @end smallexample @@ -1112,6 +1113,10 @@ Display the full contents of any sections requested. Display source code intermixed with disassembly, if possible. Implies @samp{-d}. +@item --show-raw-insn +When disassembling instructions, print the instruction in hex as well as +in symbolic form. Not all targets handle this correctly yet. + @item --stabs @cindex stab @cindex .stab diff --git a/binutils/objdump.1 b/binutils/objdump.1 index 0afdecaab8f..e3c4a25db0c 100644 --- a/binutils/objdump.1 +++ b/binutils/objdump.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1991 Free Software Foundation +.\" Copyright (c) 1991, 1996 Free Software Foundation .\" See section COPYING for conditions for redistribution .TH objdump 1 "5 November 1991" "cygnus support" "GNU Development Tools" .de BP @@ -43,6 +43,7 @@ objdump \- display information from object files. .RB "[\|" \-R | \-\-dynamic\-reloc "\|]" .RB "[\|" \-s | \-\-full\-contents "\|]" .RB "[\|" \-S | \-\-source "\|]" +.RB "[\|" \-\-show\-raw\-insn "\|]" .RB "[\|" \-\-stabs "\|]" .RB "[\|" \-t | \-\-syms "\|]" .RB "[\|" \-T | \-\-dynamic\-syms "\|]" @@ -244,6 +245,11 @@ Display the full contents of any sections requested. Display source code intermixed with disassembly, if possible. Implies \fB-d\fP. +.TP +.B \-\-show-raw-insn +When disassembling instructions, print the instruction in hex as well as +in symbolic form. Not all targets handle this correctly yet. + .TP .B \-\-stabs Display the contents of the .stab, .stab.index, and .stab.excl diff --git a/binutils/objdump.c b/binutils/objdump.c index 852588fb795..3279eb72c2e 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -52,6 +52,7 @@ int dump_ar_hdrs; /* -a */ int dump_private_headers; /* -p */ int with_line_numbers; /* -l */ boolean with_source_code; /* -S */ +int show_raw_insn; /* --show-raw-insn */ int dump_stab_section_info; /* --stabs */ boolean disassemble; /* -d */ boolean disassemble_all; /* -D */ @@ -140,7 +141,8 @@ Usage: %s [-ahifdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\ [--architecture=machine] [--reloc] [--full-contents] [--stabs]\n\ [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\ [--wide] [--version] [--help] [--private-headers]\n\ - [--start-address=addr] [--stop-address=addr] objfile...\n\ + [--start-address=addr] [--stop-address=addr]\n\ + [--show-raw-insn] objfile...\n\ at least one option besides -l (--line-numbers) must be given\n"); list_supported_targets (program_name, stream); exit (status); @@ -171,6 +173,7 @@ static struct option long_options[]= {"reloc", no_argument, NULL, 'r'}, {"section", required_argument, NULL, 'j'}, {"section-headers", no_argument, NULL, 'h'}, + {"show-raw-insn", no_argument, &show_raw_insn, 1}, {"source", no_argument, NULL, 'S'}, {"stabs", no_argument, &dump_stab_section_info, 1}, {"start-address", required_argument, NULL, OPTION_START_ADDRESS}, @@ -831,6 +834,8 @@ disassemble_data (abfd) disasm_info.application_data = (PTR) &aux; aux.abfd = abfd; disasm_info.print_address_func = objdump_print_address; + if (show_raw_insn) + disasm_info.flags |= DISASM_RAW_INSN_FLAG; if (machine != (char *) NULL) { @@ -854,6 +859,13 @@ disassemble_data (abfd) exit (1); } + disasm_info.arch = bfd_get_arch (abfd); + disasm_info.mach = bfd_get_mach (abfd); + if (bfd_big_endian (abfd)) + disasm_info.endian = BFD_ENDIAN_BIG; + else + disasm_info.endian = BFD_ENDIAN_LITTLE; + for (section = abfd->sections; section != (asection *) NULL; section = section->next) -- 2.30.2