home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / gdb-4.12.tar.gz / gdb-4.12.tar / gdb-4.12 / bfd / core.c < prev    next >
C/C++ Source or Header  |  1994-02-03  |  3KB  |  107 lines

  1. /* Core file generic interface routines for BFD.
  2.    Copyright (C) 1990-1991 Free Software Foundation, Inc.
  3.    Written by Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /*
  22. SECTION
  23.     Core files
  24.  
  25. DESCRIPTION
  26.     These are functions pertaining to core files.
  27. */
  28.  
  29. #include "bfd.h"
  30. #include "sysdep.h"
  31. #include "libbfd.h"
  32.  
  33.  
  34. /*
  35. FUNCTION
  36.     bfd_core_file_failing_command
  37.  
  38. SYNOPSIS
  39.     CONST char *bfd_core_file_failing_command(bfd *abfd);
  40.  
  41. DESCRIPTION
  42.     Return a read-only string explaining which program was running
  43.     when it failed and produced the core file @var{abfd}.
  44.  
  45. */
  46.  
  47. CONST char *
  48. DEFUN(bfd_core_file_failing_command,(abfd),
  49.       bfd *abfd)
  50. {
  51.   if (abfd->format != bfd_core) {
  52.     bfd_error = invalid_operation;
  53.     return NULL;
  54.   }
  55.   return BFD_SEND (abfd, _core_file_failing_command, (abfd));
  56. }
  57.  
  58. /*
  59. FUNCTION
  60.     bfd_core_file_failing_signal
  61.  
  62. SYNOPSIS
  63.     int bfd_core_file_failing_signal(bfd *abfd);
  64.  
  65. DESCRIPTION
  66.     Returns the signal number which caused the core dump which
  67.     generated the file the BFD @var{abfd} is attached to.
  68. */
  69.  
  70. int
  71. bfd_core_file_failing_signal (abfd)
  72.      bfd *abfd;
  73. {
  74.   if (abfd->format != bfd_core) {
  75.     bfd_error = invalid_operation;
  76.     return 0;
  77.   }
  78.   return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
  79. }
  80.  
  81.  
  82. /*
  83. FUNCTION
  84.     core_file_matches_executable_p
  85.  
  86. SYNOPSIS
  87.     boolean core_file_matches_executable_p
  88.         (bfd *core_bfd, bfd *exec_bfd);
  89.  
  90. DESCRIPTION
  91.     Return <<true>> if the core file attached to @var{core_bfd}
  92.     was generated by a run of the executable file attached to
  93.     @var{exec_bfd}, <<false>> otherwise.
  94. */
  95. boolean
  96. core_file_matches_executable_p (core_bfd, exec_bfd)
  97.      bfd *core_bfd, *exec_bfd;
  98. {
  99.     if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
  100.         bfd_error = wrong_format;
  101.         return false;
  102.     }
  103.  
  104.     return BFD_SEND (core_bfd, _core_file_matches_executable_p,
  105.              (core_bfd, exec_bfd));
  106. }
  107.