]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add support for 386 disassembly
authorSteve Chamberlain <sac@cygnus>
Fri, 1 May 1992 22:45:45 +0000 (22:45 +0000)
committerSteve Chamberlain <sac@cygnus>
Fri, 1 May 1992 22:45:45 +0000 (22:45 +0000)
binutils/.Sanitize
binutils/Makefile.in
binutils/objdump.c

index 4cc1130f36caa89867fe8b08a756c04dee83f082..d9eade3dcca58e5a0e288b611228ff9ed1437cfd 100644 (file)
@@ -49,6 +49,7 @@ copy.c
 cplus-dem.c
 filemode.c
 gmalloc.c
+i386-pinsn.c
 i960-pinsn.c
 is-ranlib.c
 is-strip.c
index 84aab220439a4bee871cdcd7f2c967e82b60858c..f42616421046cfc77a7a6b31499c4f247a99153e 100644 (file)
@@ -102,7 +102,7 @@ INCDIR = $(BASEDIR)/include
 
 # When adding .o files, to make VPATH work in Sun Make, you have to
 # also add a foo.o: foo.c line at the bottom of the file.
-DISASMS = m68k-pinsn.o i960-pinsn.o sparc-pinsn.o  am29k-pinsn.o
+DISASMS = m68k-pinsn.o i960-pinsn.o i386-pinsn.o sparc-pinsn.o  am29k-pinsn.o
 
 #\f
 ## Random definitions
@@ -351,6 +351,7 @@ not-strip.o:not-strip.c
 objdump.o: objdump.c
 size.o: size.c
 sparc-pinsn.o: sparc-pinsn.c
+i386-pinsn.o: i386-pinsn.c
 strip.o:strip.c
 version.o: $(srcdir)/version.c
        $(CC) $(CFLAGS) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) -DVERSION='"$(VERSION)"' -c $(srcdir)/version.c
index 861cc18103f353c002f3e4c7ecfd07a9636fa666..a8e7cae3260507f6778c4780cfba522d7c2ff79c 100644 (file)
@@ -54,7 +54,7 @@ PROTO (void, display_file, (char *filename, char *target));
 PROTO (void, dump_data, (bfd *abfd));
 PROTO (void, dump_relocs, (bfd *abfd));
 PROTO (void, dump_symbols, (bfd *abfd));
-PROTO (void, print_arelt_descr, (bfd *abfd, boolean verbose));
+PROTO (void, print_arelt_descr, (FILE *,bfd *abfd, boolean verbose));
 
 
 
@@ -81,10 +81,10 @@ usage ()
 }
 
 static struct option long_options[] = 
-       {{"syms",   0, &dump_symtab,          1},
-        {"reloc",  0, &dump_reloc_info,      1},
-        {"header", 0, &dump_section_headers, 1},
-        {0, 0, 0, 0}};
+       {{"syms",   no_argument, &dump_symtab,        1},
+        {"reloc",  no_argument, &dump_reloc_info,      1},
+        {"header", no_argument, &dump_section_headers, 1},
+        {0, no_argument, 0, 0}};
 
 
 
@@ -264,6 +264,7 @@ bfd *abfd;
   unsigned int print_insn_a29k();
   unsigned int print_insn_i960();
   unsigned int print_insn_sparc();
+  unsigned int print_insn_i386();
   unsigned int print_insn_h8300();
   enum bfd_architecture a;
 
@@ -316,6 +317,9 @@ bfd *abfd;
     case bfd_arch_sparc:
       print = print_insn_sparc;
       break;
+    case bfd_arch_i386:
+      print = print_insn_i386;
+      break;
     case bfd_arch_m68k:
       print = print_insn_m68k;
       break;
@@ -415,7 +419,7 @@ display_bfd (abfd)
     return;
   }
   printf ("\n%s:     file format %s\n", abfd->filename, abfd->xvec->name);
-  if (dump_ar_hdrs) print_arelt_descr (abfd, true);
+  if (dump_ar_hdrs) print_arelt_descr (stdout, abfd, true);
 
   if (dump_file_header) {
     char *comma = "";
@@ -514,40 +518,42 @@ dump_data (abfd)
        strcmp(only,section->name) == 0){
 
 
+      if (section->flags & SEC_HAS_CONTENTS) 
+       {
+         printf("Contents of section %s:\n", section->name);
 
-      printf("Contents of section %s:\n", section->name);
-
-      if (bfd_get_section_size_before_reloc(section) == 0) continue;
-      data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
-      if (data == (bfd_byte *)NULL) {
-       fprintf (stderr, "%s: memory exhausted.\n", program_name);
-       exit (1);
-      }
-      datasize = bfd_get_section_size_before_reloc(section);
+         if (bfd_get_section_size_before_reloc(section) == 0) continue;
+         data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
+         if (data == (bfd_byte *)NULL) {
+           fprintf (stderr, "%s: memory exhausted.\n", program_name);
+           exit (1);
+         }
+         datasize = bfd_get_section_size_before_reloc(section);
 
 
-      bfd_get_section_contents (abfd, section, (PTR)data, 0, bfd_get_section_size_before_reloc(section));
+         bfd_get_section_contents (abfd, section, (PTR)data, 0, bfd_get_section_size_before_reloc(section));
 
-      for (i= 0; i < bfd_get_section_size_before_reloc(section); i += onaline) {
-       bfd_size_type j;
-       printf(" %04lx ", (unsigned long int)(i + section->vma));
-       for (j = i; j < i+ onaline; j++) {
-         if (j < bfd_get_section_size_before_reloc(section))
-           printf("%02x", (unsigned)(data[j]));
-         else 
-           printf("  ");
-         if ((j & 3 ) == 3) printf(" ");
-       }
+         for (i= 0; i < bfd_get_section_size_before_reloc(section); i += onaline) {
+           bfd_size_type j;
+           printf(" %04lx ", (unsigned long int)(i + section->vma));
+           for (j = i; j < i+ onaline; j++) {
+             if (j < bfd_get_section_size_before_reloc(section))
+               printf("%02x", (unsigned)(data[j]));
+             else 
+               printf("  ");
+             if ((j & 3 ) == 3) printf(" ");
+           }
 
-       printf(" ");
-       for (j = i; j < i+onaline ; j++) {
-         if (j >= bfd_get_section_size_before_reloc(section))
            printf(" ");
-         else
-           printf("%c", isprint(data[j]) ?data[j] : '.');
+           for (j = i; j < i+onaline ; j++) {
+             if (j >= bfd_get_section_size_before_reloc(section))
+               printf(" ");
+             else
+               printf("%c", isprint(data[j]) ?data[j] : '.');
+           }
+           putchar ('\n');
+         }
        }
-       putchar ('\n');
-      }
     }
 
     free (data);