* objdump.c (usage): Mention --no-show-raw-insn.
authorIan Lance Taylor <ian@airs.com>
Sat, 15 Mar 1997 20:37:45 +0000 (20:37 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 15 Mar 1997 20:37:45 +0000 (20:37 +0000)
(long_options): Add "no-show-raw-insn".
(disassemble_bytes): Handle --no-show-raw-insn.
* binutils.texi, objdump.1: Document --no-show-raw-insn.

binutils/ChangeLog
binutils/NEWS
binutils/binutils.texi
binutils/objdump.1
binutils/objdump.c

index 84054af..1927f69 100644 (file)
@@ -1,3 +1,28 @@
+Sat Mar 15 15:35:56 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * objdump.c (usage): Mention --no-show-raw-insn.
+       (long_options): Add "no-show-raw-insn".
+       (disassemble_bytes): Handle --no-show-raw-insn.
+       * binutils.texi, objdump.1: Document --no-show-raw-insn.
+
+Wed Mar 12 11:42:00 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * rddbg.c (free_saved_stabs): Set the strings to NULL after being
+       freed.
+
+Fri Feb 28 17:18:45 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * bucomm.c (set_default_bfd_target): New function.
+       * bucomm.h (set_default_bfd_target): Declare.
+       * ar.c (main): Call set_default_bfd_target.
+       * nlmconv.c (main): Likewise.
+       * nm.c (main): Likewise.
+       * objcopy.c (main): Likewise.
+       * objdump.c (main): Likewise.
+       * size.c (main): Likewise.
+       * strings.c (main): Likewise.
+       * Makefile.in (bucomm.o): New target, to define TARGET.
+
 Tue Feb 25 21:28:38 1997  Ian Lance Taylor  <ian@cygnus.com>
 
        * objdump.c (adjust_section_vma): New static variable.
index d441ceb..832c9e9 100644 (file)
@@ -1,9 +1,11 @@
 -*- text -*-
 
-Changes since binutils 2.7
+Changes in binutils 2.8:
 
 * The objdump disassembly format has been changed, and hopefully improved.  Use
-  the new --prefix-addresses option to get the old format.
+  the new --prefix-addresses option to get the old format.  There are also new
+  --disassemble-zeroes and --no-show-raw-insn options which affect disassembler
+  output.
 
 * Formats may now be specified as configuration triplets.  For example,
   objdump -b i386-pc-linux.  The triplets are not passed through config.sub,
@@ -15,7 +17,9 @@ Changes since binutils 2.7
 
 * objdump --dynamic-reloc now works on ELF executables and shared libraries.
 
-Changes since binutils 2.6
+* Added --adjust-vma option to objdump.
+
+Changes in binutils 2.7:
 
 * Added --enable-shared and --enable-commonbfdlib options to configure.
 
@@ -33,7 +37,7 @@ Changes since binutils 2.6
 
 * Added support for Alpha OpenVMS/AXP.
 
-Changes since binutils 2.5
+Changes in binutils 2.6:
 
 * Added -N/--strip-symbol and -K/--keep-symbol arguments to strip and objcopy.
 
@@ -45,7 +49,7 @@ Changes since binutils 2.5
 
 * ar and ranlib now work on AIX.  The tools are now built by default on AIX.
 
-Changes since binutils 2.4
+Changes in binutils 2.5:
 
 * Changed objdump -dr to dump the relocs interspersed with the assembly
   listing, for a more useful listing of relocateable files.
@@ -58,7 +62,7 @@ Changes since binutils 2.4
 * strip and objcopy should now be able to handle dynamically linked ELF
   executables.
 
-Changes since binutils 2.3
+Changes in binutils 2.4:
 
 * Support for HP-PA (by Jeff Law), i386 Mach (by David Mackenzie), RS/6000 and
   PowerPC (except ar and ranlib; by Ian Taylor).
@@ -68,7 +72,7 @@ Changes since binutils 2.3
 * Programs `strip' and `objcopy' will not attempt to write dynamically linked
   ELF output files, since BFD currently can't create them properly.
 
-Changes since binutils 2.2
+Changes in binutils 2.3:
 
 * A new --stabs argument has been added to objdump to dump stabs sections in
   ELF and COFF files.
@@ -78,7 +82,7 @@ Changes since binutils 2.2
 
 * The strings program has been added.
 
-Changes since binutils 2.1
+Changes in binutils 2.2:
 
 * The 'copy' program has been renamed to 'objcopy', for consistency with
   'objdump', and because 'copy' might more plausibly be used as a synonym for
@@ -101,7 +105,7 @@ Changes since binutils 2.1
 
 * There is the beginnings of a test suite.
 
-Changes since binutils 2.0
+Changes in binutils 2.1:
 
 * There is now support for writing ECOFF files, so ld and the other utilities
   should work on Risc/Ultrix and Irix.  Please let us know how well this works.
index fac0bb0..b4efc88 100644 (file)
@@ -1050,7 +1050,7 @@ objdump [ -a | --archive-headers ]
         [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ]
         [ -w | --wide ] [ --start-address=@var{address} ]
         [ --stop-address=@var{address} ]
-        [ --prefix-addresses] [ --show-raw-insn ]
+        [ --prefix-addresses] [ --[no-]show-raw-insn ]
         [ --adjust-vma=@var{offset} ]
         [ --version ]  [ --help ]
         @var{objfile}@dots{}
@@ -1226,6 +1226,10 @@ When disassembling instructions, print the instruction in hex as well as
 in symbolic form.  This is the default except when
 @code{--prefix-addresses} is used.
 
+@item --no-show-raw-insn
+When disassembling instructions, do not print the instruction bytes.
+This is the default when @code{--prefix-addresses} is used.
+
 @item --stabs
 @cindex stab
 @cindex .stab
index 53e0501..c331d3e 100644 (file)
@@ -48,7 +48,7 @@ objdump \- display information from object files.
 .RB "[\|" \-R | \-\-dynamic\-reloc "\|]" 
 .RB "[\|" \-s | \-\-full\-contents "\|]"
 .RB "[\|" \-S | \-\-source "\|]"
-.RB "[\|" \-\-show\-raw\-insn "\|]" 
+.RB "[\|" \-\-[no\-]show\-raw\-insn "\|]" 
 .RB "[\|" \-\-stabs "\|]"
 .RB "[\|" \-t | \-\-syms "\|]" 
 .RB "[\|" \-T | \-\-dynamic\-syms "\|]" 
@@ -286,6 +286,13 @@ in symbolic form.  This is the default except when
 is used.
 
 .TP
+.B \-\-no\-show\-raw\-insn
+When disassembling instructions, do not print the instruction bytes.
+This is the default when
+.B \-\-prefix\-addresses
+is used.
+
+.TP
 .B \-\-stabs
 Display the contents of the .stab, .stab.index, and .stab.excl
 sections from an ELF file.  This is only useful on systems (such as
index 5eca0fc..6938597 100644 (file)
@@ -68,6 +68,7 @@ static int wide_output;                       /* -w */
 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 */
+static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
 
 /* Extra info to pass to the disassembler address printing function.  */
 struct objdump_disasm_info {
@@ -170,7 +171,7 @@ Usage: %s [-ahifdDprRtTxsSlw] [-b bfdname] [-m machine] [-j section-name]\n\
        [--syms] [--all-headers] [--dynamic-syms] [--dynamic-reloc]\n\
        [--wide] [--version] [--help] [--private-headers]\n\
        [--start-address=addr] [--stop-address=addr]\n\
-       [--prefix-addresses] [--show-raw-insn]\n\
+       [--prefix-addresses] [--[no-]show-raw-insn] [--adjust-vma=offset]\n\
        [-EB|-EL] [--endian={big|little}] objfile...\n\
 at least one option besides -l (--line-numbers) must be given\n");
   list_supported_targets (program_name, stream);
@@ -184,9 +185,11 @@ at least one option besides -l (--line-numbers) must be given\n");
 #define OPTION_ENDIAN (150)
 #define OPTION_START_ADDRESS (OPTION_ENDIAN + 1)
 #define OPTION_STOP_ADDRESS (OPTION_START_ADDRESS + 1)
+#define OPTION_ADJUST_VMA (OPTION_STOP_ADDRESS + 1)
 
 static struct option long_options[]=
 {
+  {"adjust-vma", required_argument, NULL, OPTION_ADJUST_VMA},
   {"all-headers", no_argument, NULL, 'x'},
   {"private-headers", no_argument, NULL, 'p'},
   {"architecture", required_argument, NULL, 'm'},
@@ -204,6 +207,7 @@ static struct option long_options[]=
   {"help", no_argument, NULL, 'H'},
   {"info", no_argument, NULL, 'i'},
   {"line-numbers", no_argument, NULL, 'l'},
+  {"no-show-raw-insn", no_argument, &show_raw_insn, -1},
   {"prefix-addresses", no_argument, &prefix_addresses, 1},
   {"reloc", no_argument, NULL, 'r'},
   {"section", required_argument, NULL, 'j'},
@@ -1166,7 +1170,9 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
              buf[j - i] = '\0';
            }
 
-         if (! prefix_addresses || show_raw_insn)
+         if (prefix_addresses
+             ? show_raw_insn > 0
+             : show_raw_insn >= 0)
            {
              long j;
 
@@ -1216,7 +1222,9 @@ disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
 
          printf ("%s", buf);
 
-         if (! prefix_addresses || show_raw_insn)
+         if (prefix_addresses
+             ? show_raw_insn > 0
+             : show_raw_insn >= 0)
            {
              while (pb < bytes)
                {
@@ -1481,7 +1489,8 @@ disassemble_data (abfd)
          asymbol *sym;
          long place;
 
-         sym = find_symbol_for_address (abfd, section, i, true, &place);
+         sym = find_symbol_for_address (abfd, section, section->vma + i,
+                                        true, &place);
          ++place;
          while (i < stop)
            {
@@ -1489,7 +1498,10 @@ disassemble_data (abfd)
              long nextstop;
              boolean insns;
 
-             disasm_info.symbol = sym;
+             if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + i)
+               disasm_info.symbol = sym;
+             else
+               disasm_info.symbol = NULL;
 
              printf ("\n");
              objdump_print_addr_with_sym (abfd, section, sym,
@@ -1498,7 +1510,9 @@ disassemble_data (abfd)
                                           false);
              printf (":\n");
 
-             if (sym == NULL)
+             if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
+               nextsym = sym;
+             else if (sym == NULL)
                nextsym = NULL;
              else
                {
@@ -1513,7 +1527,13 @@ disassemble_data (abfd)
                    nextsym = sorted_syms[place];
                }
 
-             if (nextsym == NULL)
+             if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
+               {
+                 nextstop = bfd_asymbol_value (sym) - section->vma;
+                 if (nextstop > stop)
+                   nextstop = stop;
+               }
+             else if (nextsym == NULL)
                nextstop = stop;
              else
                {
@@ -1527,6 +1547,7 @@ disassemble_data (abfd)
                  disassembling them.  */
              if (disassemble_all
                  || sym == NULL
+                 || bfd_asymbol_value (sym) > section->vma + i
                  || ((sym->flags & BSF_OBJECT) == 0
                      && (strstr (bfd_asymbol_name (sym), "gnu_compiled")
                          == NULL)
@@ -1812,6 +1833,20 @@ display_bfd (abfd)
       return;
     }
 
+  /* If we are adjusting section VMA's, change them all now.  Changing
+     the BFD information is a hack.  However, we must do it, or
+     bfd_find_nearest_line will not do the right thing.  */
+  if (adjust_section_vma != 0)
+    {
+      asection *s;
+
+      for (s = abfd->sections; s != NULL; s = s->next)
+       {
+         s->vma += adjust_section_vma;
+         s->lma += adjust_section_vma;
+       }
+    }
+
   printf ("\n%s:     file format %s\n", bfd_get_filename (abfd),
          abfd->xvec->name);
   if (dump_ar_hdrs)
@@ -2436,6 +2471,7 @@ main (argc, argv)
   START_PROGRESS (program_name, 0);
 
   bfd_init ();
+  set_default_bfd_target ();
 
   while ((c = getopt_long (argc, argv, "pib:m:VdDlfahrRtTxsSj:wE:",
                           long_options, (int *) 0))
@@ -2515,6 +2551,9 @@ main (argc, argv)
        case 'w':
          wide_output = 1;
          break;
+       case OPTION_ADJUST_VMA:
+         adjust_section_vma = parse_vma (optarg, "--adjust-vma");
+         break;
        case OPTION_START_ADDRESS:
          start_address = parse_vma (optarg, "--start-address");
          break;