aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorSteve Chamberlain <steve@cygnus>1991-04-23 16:02:09 +0000
committerSteve Chamberlain <steve@cygnus>1991-04-23 16:02:09 +0000
commit9872a49c27a0cced505d4d94d543c7d0b647186e (patch)
treef656c6bd7a6bc9bd72abeabc8a1124ba72d4675f /binutils/objdump.c
parenta37cc0c05c5ee0e72a14a09c547555621371ef1d (diff)
downloadgdb-9872a49c27a0cced505d4d94d543c7d0b647186e.zip
gdb-9872a49c27a0cced505d4d94d543c7d0b647186e.tar.gz
gdb-9872a49c27a0cced505d4d94d543c7d0b647186e.tar.bz2
*** empty log message ***
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c71
1 files changed, 69 insertions, 2 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 4f764bd..eae1860 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -48,6 +48,7 @@ int dump_reloc_info; /* -r */
int dump_ar_hdrs; /* -a */
int with_line_numbers; /* -l */
boolean disassemble; /* -d */
+boolean info; /* -i */
char *only;
PROTO (void, display_file, (char *filename, char *target));
@@ -75,7 +76,7 @@ void
usage ()
{
fprintf (stderr,
- "usage: %s [-ahfdrtxsl] [-m machine] [-j section_name] obj ...\n",
+ "usage: %s [-ahifdrtxsl] [-m machine] [-j section_name] obj ...\n",
program_name);
exit (1);
}
@@ -597,7 +598,65 @@ bfd *abfd;
}
}
+static void
+DEFUN_VOID(display_info)
+{
+ unsigned int i;
+ extern bfd_target *target_vector[];
+
+ enum bfd_architecture j;
+ i = 0;
+ printf("BFD header file version %s\n", BFD_VERSION);
+ while (target_vector[i] != (bfd_target *)NULL)
+ {
+ bfd_target *p = target_vector[i];
+ bfd *abfd = bfd_openw("##dummy",p->name);
+ printf("%s\n (header %s, data %s)\n", p->name,
+ p->header_byteorder_big_p ? "big endian" : "little endian",
+ p->byteorder_big_p ? "big endian" : "little endian" );
+ {
+ enum bfd_architecture j;
+ for (j = bfd_arch_obscure +1; j < bfd_arch_last; j++)
+ {
+ if (bfd_set_arch_mach(abfd, j, 0))
+ {
+ printf(" %s\n", bfd_printable_arch_mach(j,0));
+ }
+ }
+ }
+ i++;
+ }
+ /* Again as a table */
+ printf("%12s"," ");
+ for (i = 0; target_vector[i]; i++) {
+ printf("%s ",target_vector[i]->name);
+ }
+ printf("\n");
+ for (j = bfd_arch_obscure +1; j < bfd_arch_last; j++) {
+ printf("%11s ", bfd_printable_arch_mach(j,0));
+ for (i = 0; target_vector[i]; i++) {
+ {
+ bfd_target *p = target_vector[i];
+ bfd *abfd = bfd_openw("##dummy",p->name);
+ int l = strlen(p->name);
+ int ok = bfd_set_arch_mach(abfd, j, 0);
+ if (ok) {
+ printf("%s ", p->name);
+ }
+ else {
+ while (l--) {
+ printf("%c",ok?'*':'-');
+ }
+ printf(" ");
+ }
+
+ }
+ }
+
+ printf("\n");
+ }
+}
/** main and like trivia */
int
main (argc, argv)
@@ -613,7 +672,7 @@ main (argc, argv)
program_name = *argv;
- while ((c = getopt_long (argc, argv, "b:m:dlfahrtxsj:", long_options, &ind))
+ while ((c = getopt_long (argc, argv, "ib:m:dlfahrtxsj:", long_options, &ind))
!= EOF) {
seenflag = true;
switch (c) {
@@ -632,6 +691,9 @@ main (argc, argv)
case 'f':
dump_file_header = true;
break;
+ case 'i':
+ info = true;
+ break;
case 'x':
dump_symtab = 1;
dump_reloc_info = 1;
@@ -654,10 +716,15 @@ main (argc, argv)
if (seenflag == false)
usage ();
+ if (info) {
+ display_info();
+ }
+ else {
if (optind == argc)
display_file ("a.out", target);
else
for (; optind < argc;)
display_file (argv[optind++], target);
+}
return 0;
}