* objdump.c (disassemble_data): Handle unknown endianness.
[deliverable/binutils-gdb.git] / binutils / objdump.c
index b419346bb11863304acf28426a848e18993d9097..19b1243985c29f559a39deb09559497872970a2b 100644 (file)
@@ -1,5 +1,5 @@
 /* objdump.c -- dump information about an object file.
-   Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -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},
@@ -220,6 +223,8 @@ dump_section_header (abfd, section, ignored)
   PF (SEC_ROM, "ROM");
   PF (SEC_DEBUGGING, "DEBUGGING");
   PF (SEC_NEVER_LOAD, "NEVER_LOAD");
+  PF (SEC_EXCLUDE, "EXCLUDE");
+  PF (SEC_SORT_ENTRIES, "SORT ENTRIES");
   printf ("\n");
 #undef PF
 }
@@ -829,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)
     {
@@ -852,6 +859,17 @@ 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 if (bfd_little_endian (abfd))
+    disasm_info.endian = BFD_ENDIAN_LITTLE;
+  else
+    /* ??? Aborting here seems too drastic.  We could default to big or little
+       instead.  */
+    disasm_info.endian = BFD_ENDIAN_UNKNOWN;
+
   for (section = abfd->sections;
        section != (asection *) NULL;
        section = section->next)
@@ -1294,7 +1312,7 @@ display_bfd (abfd)
   putchar ('\n');
   if (dump_section_headers)
     dump_headers (abfd);
-  if (dump_symtab || dump_reloc_info || disassemble)
+  if (dump_symtab || dump_reloc_info || disassemble || dump_debugging)
     {
       syms = slurp_symtab (abfd);
     }
@@ -1320,7 +1338,7 @@ display_bfd (abfd)
     {
       PTR dhandle;
 
-      dhandle = read_debugging_info (abfd);
+      dhandle = read_debugging_info (abfd, syms, symcount);
       if (dhandle != NULL)
        {
          if (! print_debugging_info (stdout, dhandle))
This page took 0.06168 seconds and 4 git commands to generate.