OLD | NEW |
1 /* BFD backend for core files which use the ptrace_user structure | 1 /* BFD backend for core files which use the ptrace_user structure |
2 Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, | 2 Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, |
3 2005, 2006, 2007 Free Software Foundation, Inc. | 3 2005, 2006, 2007, 2012 Free Software Foundation, Inc. |
4 The structure of this file is based on trad-core.c written by John Gilmore | 4 The structure of this file is based on trad-core.c written by John Gilmore |
5 of Cygnus Support. | 5 of Cygnus Support. |
6 Modified to work with the ptrace_user structure by Kevin A. Buettner. | 6 Modified to work with the ptrace_user structure by Kevin A. Buettner. |
7 (Longterm it may be better to merge this file with trad-core.c) | 7 (Longterm it may be better to merge this file with trad-core.c) |
8 | 8 |
9 This file is part of BFD, the Binary File Descriptor library. | 9 This file is part of BFD, the Binary File Descriptor library. |
10 | 10 |
11 This program is free software; you can redistribute it and/or modify | 11 This program is free software; you can redistribute it and/or modify |
12 it under the terms of the GNU General Public License as published by | 12 it under the terms of the GNU General Public License as published by |
13 the Free Software Foundation; either version 3 of the License, or | 13 the Free Software Foundation; either version 3 of the License, or |
(...skipping 14 matching lines...) Expand all Loading... |
28 #include "sysdep.h" | 28 #include "sysdep.h" |
29 #include "bfd.h" | 29 #include "bfd.h" |
30 #include "libbfd.h" | 30 #include "libbfd.h" |
31 | 31 |
32 #include <sys/param.h> | 32 #include <sys/param.h> |
33 #include <sys/dir.h> | 33 #include <sys/dir.h> |
34 #include <signal.h> | 34 #include <signal.h> |
35 #include <sys/ptrace.h> | 35 #include <sys/ptrace.h> |
36 | 36 |
37 struct trad_core_struct | 37 struct trad_core_struct |
38 { | 38 { |
39 asection *data_section; | 39 asection *data_section; |
40 asection *stack_section; | 40 asection *stack_section; |
41 asection *reg_section; | 41 asection *reg_section; |
42 struct ptrace_user u; | 42 struct ptrace_user u; |
43 }; | 43 }; |
44 | 44 |
45 #define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u)) | 45 #define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u)) |
46 #define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section) | 46 #define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section) |
47 #define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section) | 47 #define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section) |
48 #define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section) | 48 #define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section) |
49 | 49 |
50 /* forward declarations */ | 50 /* forward declarations */ |
51 | 51 |
52 const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd)); | 52 const bfd_target *ptrace_unix_core_file_p (bfd *abfd); |
53 char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd)); | 53 char * ptrace_unix_core_file_failing_command (bfd *abfd); |
54 int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); | 54 int ptrace_unix_core_file_failing_signal (bfd *abfd); |
55 #define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_exe
cutable_p | 55 #define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_exe
cutable_p |
56 #define ptrace_unix_core_file_pid _bfd_nocore_core_file_pid | 56 #define ptrace_unix_core_file_pid _bfd_nocore_core_file_pid |
57 static void swap_abort PARAMS ((void)); | 57 static void swap_abort (void); |
58 | 58 |
59 const bfd_target * | 59 const bfd_target * |
60 ptrace_unix_core_file_p (abfd) | 60 ptrace_unix_core_file_p (bfd *abfd) |
61 bfd *abfd; | |
62 | |
63 { | 61 { |
64 int val; | 62 int val; |
65 struct ptrace_user u; | 63 struct ptrace_user u; |
66 struct trad_core_struct *rawptr; | 64 struct trad_core_struct *rawptr; |
67 bfd_size_type amt; | 65 bfd_size_type amt; |
68 flagword flags; | 66 flagword flags; |
69 | 67 |
70 val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); | 68 val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); |
71 if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC | 69 if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC |
72 || u.pt_rev != _BCS_PTRACE_REV) | 70 || u.pt_rev != _BCS_PTRACE_REV) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return abfd->xvec; | 128 return abfd->xvec; |
131 | 129 |
132 fail: | 130 fail: |
133 bfd_release (abfd, abfd->tdata.any); | 131 bfd_release (abfd, abfd->tdata.any); |
134 abfd->tdata.any = NULL; | 132 abfd->tdata.any = NULL; |
135 bfd_section_list_clear (abfd); | 133 bfd_section_list_clear (abfd); |
136 return NULL; | 134 return NULL; |
137 } | 135 } |
138 | 136 |
139 char * | 137 char * |
140 ptrace_unix_core_file_failing_command (abfd) | 138 ptrace_unix_core_file_failing_command (bfd *abfd) |
141 bfd *abfd; | |
142 { | 139 { |
143 char *com = abfd->tdata.trad_core_data->u.pt_comm; | 140 char *com = abfd->tdata.trad_core_data->u.pt_comm; |
| 141 |
144 if (*com) | 142 if (*com) |
145 return com; | 143 return com; |
146 else | 144 else |
147 return 0; | 145 return 0; |
error: old chunk mismatch |
None
OLD | NEW |