* hppa.h (FLAG_STRICT): Correct comment.
[deliverable/binutils-gdb.git] / bfd / corefile.c
CommitLineData
252b5132 1/* Core file generic interface routines for BFD.
c58b9523 2 Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003
7898deda 3 Free Software Foundation, Inc.
252b5132
RH
4 Written by Cygnus Support.
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
3e110533 20Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
252b5132
RH
21
22/*
23SECTION
24 Core files
25
26DESCRIPTION
27 These are functions pertaining to core files.
28*/
29
30#include "bfd.h"
31#include "sysdep.h"
32#include "libbfd.h"
33
252b5132
RH
34/*
35FUNCTION
36 bfd_core_file_failing_command
37
38SYNOPSIS
c58b9523 39 const char *bfd_core_file_failing_command (bfd *abfd);
252b5132
RH
40
41DESCRIPTION
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
3f9c735e 47const char *
c58b9523 48bfd_core_file_failing_command (bfd *abfd)
252b5132 49{
c58b9523
AM
50 if (abfd->format != bfd_core)
51 {
52 bfd_set_error (bfd_error_invalid_operation);
53 return NULL;
54 }
252b5132
RH
55 return BFD_SEND (abfd, _core_file_failing_command, (abfd));
56}
57
58/*
59FUNCTION
60 bfd_core_file_failing_signal
61
62SYNOPSIS
c58b9523 63 int bfd_core_file_failing_signal (bfd *abfd);
252b5132
RH
64
65DESCRIPTION
66 Returns the signal number which caused the core dump which
67 generated the file the BFD @var{abfd} is attached to.
68*/
69
70int
c58b9523 71bfd_core_file_failing_signal (bfd *abfd)
252b5132 72{
c58b9523
AM
73 if (abfd->format != bfd_core)
74 {
75 bfd_set_error (bfd_error_invalid_operation);
76 return 0;
77 }
252b5132
RH
78 return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
79}
80
252b5132
RH
81/*
82FUNCTION
83 core_file_matches_executable_p
84
85SYNOPSIS
b34976b6 86 bfd_boolean core_file_matches_executable_p
c58b9523 87 (bfd *core_bfd, bfd *exec_bfd);
252b5132
RH
88
89DESCRIPTION
b34976b6 90 Return <<TRUE>> if the core file attached to @var{core_bfd}
252b5132 91 was generated by a run of the executable file attached to
b34976b6 92 @var{exec_bfd}, <<FALSE>> otherwise.
252b5132 93*/
c58b9523 94
b34976b6 95bfd_boolean
c58b9523 96core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
252b5132 97{
c58b9523
AM
98 if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object)
99 {
100 bfd_set_error (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));
252b5132 106}
This page took 0.282422 seconds and 4 git commands to generate.