2000-12-03 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / bfd / corefile.c
CommitLineData
252b5132
RH
1/* Core file generic interface routines for BFD.
2 Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21/*
22SECTION
23 Core files
24
25DESCRIPTION
26 These are functions pertaining to core files.
27*/
28
29#include "bfd.h"
30#include "sysdep.h"
31#include "libbfd.h"
32
252b5132
RH
33/*
34FUNCTION
35 bfd_core_file_failing_command
36
37SYNOPSIS
38 CONST char *bfd_core_file_failing_command(bfd *abfd);
39
40DESCRIPTION
41 Return a read-only string explaining which program was running
42 when it failed and produced the core file @var{abfd}.
43
44*/
45
46CONST char *
47bfd_core_file_failing_command (abfd)
48 bfd *abfd;
49{
50 if (abfd->format != bfd_core) {
51 bfd_set_error (bfd_error_invalid_operation);
52 return NULL;
53 }
54 return BFD_SEND (abfd, _core_file_failing_command, (abfd));
55}
56
57/*
58FUNCTION
59 bfd_core_file_failing_signal
60
61SYNOPSIS
62 int bfd_core_file_failing_signal(bfd *abfd);
63
64DESCRIPTION
65 Returns the signal number which caused the core dump which
66 generated the file the BFD @var{abfd} is attached to.
67*/
68
69int
70bfd_core_file_failing_signal (abfd)
71 bfd *abfd;
72{
73 if (abfd->format != bfd_core) {
74 bfd_set_error (bfd_error_invalid_operation);
75 return 0;
76 }
77 return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
78}
79
252b5132
RH
80/*
81FUNCTION
82 core_file_matches_executable_p
83
84SYNOPSIS
85 boolean core_file_matches_executable_p
86 (bfd *core_bfd, bfd *exec_bfd);
87
88DESCRIPTION
89 Return <<true>> if the core file attached to @var{core_bfd}
90 was generated by a run of the executable file attached to
91 @var{exec_bfd}, <<false>> otherwise.
92*/
93boolean
94core_file_matches_executable_p (core_bfd, exec_bfd)
95 bfd *core_bfd, *exec_bfd;
96{
97 if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
98 bfd_set_error (bfd_error_wrong_format);
99 return false;
100 }
101
102 return BFD_SEND (core_bfd, _core_file_matches_executable_p,
103 (core_bfd, exec_bfd));
104}
This page took 0.062881 seconds and 4 git commands to generate.