gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / binutils / coffdump.c
index d871e1ebdb2c6e4c41d300458b203f279617d568..336da57ca21e0ef0da7bd8c8d9678bdba752c7f1 100644 (file)
@@ -1,6 +1,5 @@
 /* Coff file dumper.
-   Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007,
-   2011 Free Software Foundation, Inc.
+   Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -268,6 +267,7 @@ dump_coff_where (struct coff_where *p)
       break;
     case coff_where_strtag:
       printf ("STRTAG");
+      break;
     case coff_where_entag:
       printf ("ENTAG");
       break;
@@ -418,21 +418,23 @@ dump_coff_sfile (struct coff_sfile *p)
 static void
 dump_coff_section (struct coff_section *ptr)
 {
-  int i;
+  unsigned int i;
 
   tab (1);
-  printf (_("section %s %d %d address %x size %x number %d nrelocs %d"),
+  printf (_("section %s %d %d address %x size %x number %d nrelocs %u"),
          ptr->name, ptr->code, ptr->data, ptr->address,ptr->size,
          ptr->number, ptr->nrelocs);
   nl ();
 
   for (i = 0; i < ptr->nrelocs; i++)
     {
+      struct coff_reloc * r = ptr->relocs + i;
       tab (0);
       printf ("(%x %s %x)",
-             ptr->relocs[i].offset,
-             ptr->relocs[i].symbol->name,
-             ptr->relocs[i].addend);
+             r->offset,
+             /* PR 17512: file: 0a38fb7c.  */
+             r->symbol == NULL ? _("<no sym>") : r->symbol->name,
+             r->addend);
       nl ();
     }
 
@@ -454,8 +456,6 @@ coff_dump (struct coff_ofile *ptr)
     dump_coff_section (ptr->sections + i);
 }
 
-char * program_name;
-
 static void
 show_usage (FILE *file, int status)
 {
@@ -499,6 +499,7 @@ main (int ac, char **av)
 
   program_name = av[0];
   xmalloc_set_program_name (program_name);
+  bfd_set_error_program_name (program_name);
 
   expandargv (&ac, &av);
 
@@ -550,9 +551,11 @@ main (int ac, char **av)
     }
 
   tree = coff_grok (abfd);
-
-  coff_dump (tree);
-  printf ("\n");
+  if (tree)
+    {
+      coff_dump (tree);
+      printf ("\n");
+    }
 
   return 0;
 }
This page took 0.024892 seconds and 4 git commands to generate.