binutils/testsuite/
[binutils.git] / bfd / corefile.c
blobadc5b4ac88ee859bc66b3195773ea974a88070b3
1 /* Core file generic interface routines for BFD.
2 Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4 Written by Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
23 SECTION
24 Core files
26 SUBSECTION
27 Core file functions
29 DESCRIPTION
30 These are functions pertaining to core files.
33 #include "bfd.h"
34 #include "sysdep.h"
35 #include "libbfd.h"
38 FUNCTION
39 bfd_core_file_failing_command
41 SYNOPSIS
42 const char *bfd_core_file_failing_command (bfd *abfd);
44 DESCRIPTION
45 Return a read-only string explaining which program was running
46 when it failed and produced the core file @var{abfd}.
50 const char *
51 bfd_core_file_failing_command (bfd *abfd)
53 if (abfd->format != bfd_core)
55 bfd_set_error (bfd_error_invalid_operation);
56 return NULL;
58 return BFD_SEND (abfd, _core_file_failing_command, (abfd));
62 FUNCTION
63 bfd_core_file_failing_signal
65 SYNOPSIS
66 int bfd_core_file_failing_signal (bfd *abfd);
68 DESCRIPTION
69 Returns the signal number which caused the core dump which
70 generated the file the BFD @var{abfd} is attached to.
73 int
74 bfd_core_file_failing_signal (bfd *abfd)
76 if (abfd->format != bfd_core)
78 bfd_set_error (bfd_error_invalid_operation);
79 return 0;
81 return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
85 FUNCTION
86 core_file_matches_executable_p
88 SYNOPSIS
89 bfd_boolean core_file_matches_executable_p
90 (bfd *core_bfd, bfd *exec_bfd);
92 DESCRIPTION
93 Return <<TRUE>> if the core file attached to @var{core_bfd}
94 was generated by a run of the executable file attached to
95 @var{exec_bfd}, <<FALSE>> otherwise.
98 bfd_boolean
99 core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
101 if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object)
103 bfd_set_error (bfd_error_wrong_format);
104 return FALSE;
107 return BFD_SEND (core_bfd, _core_file_matches_executable_p,
108 (core_bfd, exec_bfd));