mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 14:59:31 +08:00
Add support for 386 disassembly
This commit is contained in:
@ -49,6 +49,7 @@ copy.c
|
|||||||
cplus-dem.c
|
cplus-dem.c
|
||||||
filemode.c
|
filemode.c
|
||||||
gmalloc.c
|
gmalloc.c
|
||||||
|
i386-pinsn.c
|
||||||
i960-pinsn.c
|
i960-pinsn.c
|
||||||
is-ranlib.c
|
is-ranlib.c
|
||||||
is-strip.c
|
is-strip.c
|
||||||
|
@ -102,7 +102,7 @@ INCDIR = $(BASEDIR)/include
|
|||||||
|
|
||||||
# When adding .o files, to make VPATH work in Sun Make, you have to
|
# 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.
|
# 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
|
||||||
|
|
||||||
#
|
#
|
||||||
## Random definitions
|
## Random definitions
|
||||||
@ -351,6 +351,7 @@ not-strip.o:not-strip.c
|
|||||||
objdump.o: objdump.c
|
objdump.o: objdump.c
|
||||||
size.o: size.c
|
size.o: size.c
|
||||||
sparc-pinsn.o: sparc-pinsn.c
|
sparc-pinsn.o: sparc-pinsn.c
|
||||||
|
i386-pinsn.o: i386-pinsn.c
|
||||||
strip.o:strip.c
|
strip.o:strip.c
|
||||||
version.o: $(srcdir)/version.c
|
version.o: $(srcdir)/version.c
|
||||||
$(CC) $(CFLAGS) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) -DVERSION='"$(VERSION)"' -c $(srcdir)/version.c
|
$(CC) $(CFLAGS) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) -DVERSION='"$(VERSION)"' -c $(srcdir)/version.c
|
||||||
|
@ -54,7 +54,7 @@ PROTO (void, display_file, (char *filename, char *target));
|
|||||||
PROTO (void, dump_data, (bfd *abfd));
|
PROTO (void, dump_data, (bfd *abfd));
|
||||||
PROTO (void, dump_relocs, (bfd *abfd));
|
PROTO (void, dump_relocs, (bfd *abfd));
|
||||||
PROTO (void, dump_symbols, (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[] =
|
static struct option long_options[] =
|
||||||
{{"syms", 0, &dump_symtab, 1},
|
{{"syms", no_argument, &dump_symtab, 1},
|
||||||
{"reloc", 0, &dump_reloc_info, 1},
|
{"reloc", no_argument, &dump_reloc_info, 1},
|
||||||
{"header", 0, &dump_section_headers, 1},
|
{"header", no_argument, &dump_section_headers, 1},
|
||||||
{0, 0, 0, 0}};
|
{0, no_argument, 0, 0}};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -264,6 +264,7 @@ bfd *abfd;
|
|||||||
unsigned int print_insn_a29k();
|
unsigned int print_insn_a29k();
|
||||||
unsigned int print_insn_i960();
|
unsigned int print_insn_i960();
|
||||||
unsigned int print_insn_sparc();
|
unsigned int print_insn_sparc();
|
||||||
|
unsigned int print_insn_i386();
|
||||||
unsigned int print_insn_h8300();
|
unsigned int print_insn_h8300();
|
||||||
enum bfd_architecture a;
|
enum bfd_architecture a;
|
||||||
|
|
||||||
@ -316,6 +317,9 @@ bfd *abfd;
|
|||||||
case bfd_arch_sparc:
|
case bfd_arch_sparc:
|
||||||
print = print_insn_sparc;
|
print = print_insn_sparc;
|
||||||
break;
|
break;
|
||||||
|
case bfd_arch_i386:
|
||||||
|
print = print_insn_i386;
|
||||||
|
break;
|
||||||
case bfd_arch_m68k:
|
case bfd_arch_m68k:
|
||||||
print = print_insn_m68k;
|
print = print_insn_m68k;
|
||||||
break;
|
break;
|
||||||
@ -415,7 +419,7 @@ display_bfd (abfd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf ("\n%s: file format %s\n", abfd->filename, abfd->xvec->name);
|
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) {
|
if (dump_file_header) {
|
||||||
char *comma = "";
|
char *comma = "";
|
||||||
@ -514,40 +518,42 @@ dump_data (abfd)
|
|||||||
strcmp(only,section->name) == 0){
|
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 (bfd_get_section_size_before_reloc(section) == 0) continue;
|
if (data == (bfd_byte *)NULL) {
|
||||||
data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
|
fprintf (stderr, "%s: memory exhausted.\n", program_name);
|
||||||
if (data == (bfd_byte *)NULL) {
|
exit (1);
|
||||||
fprintf (stderr, "%s: memory exhausted.\n", program_name);
|
}
|
||||||
exit (1);
|
datasize = bfd_get_section_size_before_reloc(section);
|
||||||
}
|
|
||||||
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) {
|
for (i= 0; i < bfd_get_section_size_before_reloc(section); i += onaline) {
|
||||||
bfd_size_type j;
|
bfd_size_type j;
|
||||||
printf(" %04lx ", (unsigned long int)(i + section->vma));
|
printf(" %04lx ", (unsigned long int)(i + section->vma));
|
||||||
for (j = i; j < i+ onaline; j++) {
|
for (j = i; j < i+ onaline; j++) {
|
||||||
if (j < bfd_get_section_size_before_reloc(section))
|
if (j < bfd_get_section_size_before_reloc(section))
|
||||||
printf("%02x", (unsigned)(data[j]));
|
printf("%02x", (unsigned)(data[j]));
|
||||||
else
|
else
|
||||||
printf(" ");
|
printf(" ");
|
||||||
if ((j & 3 ) == 3) printf(" ");
|
if ((j & 3 ) == 3) printf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" ");
|
|
||||||
for (j = i; j < i+onaline ; j++) {
|
|
||||||
if (j >= bfd_get_section_size_before_reloc(section))
|
|
||||||
printf(" ");
|
printf(" ");
|
||||||
else
|
for (j = i; j < i+onaline ; j++) {
|
||||||
printf("%c", isprint(data[j]) ?data[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);
|
free (data);
|
||||||
|
Reference in New Issue
Block a user