1 | /* Core file generic interface routines for BFD.
|
---|
2 | Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002
|
---|
3 | Free Software Foundation, Inc.
|
---|
4 | Written by Cygnus Support.
|
---|
5 |
|
---|
6 | This file is part of BFD, the Binary File Descriptor library.
|
---|
7 |
|
---|
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.
|
---|
12 |
|
---|
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.
|
---|
17 |
|
---|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | SECTION
|
---|
24 | Core files
|
---|
25 |
|
---|
26 | DESCRIPTION
|
---|
27 | These are functions pertaining to core files.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #include "bfd.h"
|
---|
31 | #include "sysdep.h"
|
---|
32 | #include "libbfd.h"
|
---|
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 | bfd_core_file_failing_command (abfd)
|
---|
49 | bfd *abfd;
|
---|
50 | {
|
---|
51 | if (abfd->format != bfd_core) {
|
---|
52 | bfd_set_error (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_set_error (bfd_error_invalid_operation);
|
---|
76 | return 0;
|
---|
77 | }
|
---|
78 | return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
|
---|
79 | }
|
---|
80 |
|
---|
81 | /*
|
---|
82 | FUNCTION
|
---|
83 | core_file_matches_executable_p
|
---|
84 |
|
---|
85 | SYNOPSIS
|
---|
86 | bfd_boolean core_file_matches_executable_p
|
---|
87 | (bfd *core_bfd, bfd *exec_bfd);
|
---|
88 |
|
---|
89 | DESCRIPTION
|
---|
90 | Return <<TRUE>> if the core file attached to @var{core_bfd}
|
---|
91 | was generated by a run of the executable file attached to
|
---|
92 | @var{exec_bfd}, <<FALSE>> otherwise.
|
---|
93 | */
|
---|
94 | bfd_boolean
|
---|
95 | core_file_matches_executable_p (core_bfd, exec_bfd)
|
---|
96 | bfd *core_bfd, *exec_bfd;
|
---|
97 | {
|
---|
98 | if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
|
---|
99 | bfd_set_error (bfd_error_wrong_format);
|
---|
100 | return FALSE;
|
---|
101 | }
|
---|
102 |
|
---|
103 | return BFD_SEND (core_bfd, _core_file_matches_executable_p,
|
---|
104 | (core_bfd, exec_bfd));
|
---|
105 | }
|
---|