[gdb/testsuite] Add PR number to KFAIL in gdb.opt/inline-cmds.exp
[deliverable/binutils-gdb.git] / bfd / lynx-core.c
index 0b4af04387b5b18da555e8c7b128c6e67ea4844b..08d088386114195c4b41cedd340ddb46e50abfcf 100644 (file)
@@ -1,6 +1,5 @@
 /* BFD back end for Lynx core files
 /* BFD back end for Lynx core files
-   Copyright 1993, 1994, 1995, 2001, 2002, 2004, 2005, 2006, 2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1993-2020 Free Software Foundation, Inc.
    Written by Stu Grossman of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Written by Stu Grossman of Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -86,7 +85,7 @@ make_bfd_asection (bfd *abfd,
   return asect;
 }
 
   return asect;
 }
 
-const bfd_target *
+bfd_cleanup
 lynx_core_file_p (bfd *abfd)
 {
   int secnum;
 lynx_core_file_p (bfd *abfd)
 {
   int secnum;
@@ -95,7 +94,7 @@ lynx_core_file_p (bfd *abfd)
   core_st_t *threadp;
   int pagesize;
   asection *newsect;
   core_st_t *threadp;
   int pagesize;
   asection *newsect;
-  bfd_size_type amt;
+  size_t amt;
 
   pagesize = getpagesize ();   /* Serious cross-target issue here...  This
                                   really needs to come from a system-specific
 
   pagesize = getpagesize ();   /* Serious cross-target issue here...  This
                                   really needs to come from a system-specific
@@ -127,24 +126,13 @@ lynx_core_file_p (bfd *abfd)
 
   tcontext_size = pss.threadcnt * sizeof (core_st_t);
 
 
   tcontext_size = pss.threadcnt * sizeof (core_st_t);
 
-  /* Allocate space for the thread contexts */
-
-  threadp = (core_st_t *) bfd_alloc (abfd, tcontext_size);
-  if (!threadp)
-    goto fail;
-
   /* Save thread contexts */
   /* Save thread contexts */
-
-  if (bfd_seek (abfd, (file_ptr) pagesize, SEEK_SET) != 0)
+  if (bfd_seek (abfd, pagesize, SEEK_SET) != 0)
+    goto fail;
+  threadp = (core_st_t *) _bfd_alloc_and_read (abfd, tcontext_size,
+                                              tcontext_size);
+  if (!threadp)
     goto fail;
     goto fail;
-
-  if (bfd_bread ((void *) threadp, tcontext_size, abfd) != tcontext_size)
-    {
-      /* Probably too small to be a core file */
-      if (bfd_get_error () != bfd_error_system_call)
-       bfd_set_error (bfd_error_wrong_format);
-      goto fail;
-    }
 
   core_signal (abfd) = threadp->currsig;
 
 
   core_signal (abfd) = threadp->currsig;
 
@@ -163,11 +151,11 @@ lynx_core_file_p (bfd *abfd)
                               pagesize + tcontext_size + pss.ssize
 #if defined (SPARC) || defined (__SPARC__)
                               /* SPARC Lynx seems to start dumping
                               pagesize + tcontext_size + pss.ssize
 #if defined (SPARC) || defined (__SPARC__)
                               /* SPARC Lynx seems to start dumping
-                                  the .data section at a page
-                                  boundary.  It's OK to check a
-                                  #define like SPARC here because this
-                                  file can only be compiled on a Lynx
-                                  host.  */
+                                 the .data section at a page
+                                 boundary.  It's OK to check a
+                                 #define like SPARC here because this
+                                 file can only be compiled on a Lynx
+                                 host.  */
                               + pss.data_start % pagesize
 #endif
                               );
                               + pss.data_start % pagesize
 #endif
                               );
@@ -203,7 +191,7 @@ lynx_core_file_p (bfd *abfd)
        goto fail;
     }
 
        goto fail;
     }
 
-  return abfd->xvec;
+  return _bfd_no_cleanup;
 
  fail:
   bfd_release (abfd, core_hdr (abfd));
 
  fail:
   bfd_release (abfd, core_hdr (abfd));
This page took 0.025233 seconds and 4 git commands to generate.