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