| OLD | NEW |
| 1 /* BFD back-end for HPPA BSD core files. | 1 /* BFD back-end for HPPA BSD core files. |
| 2 Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005, | 2 Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005, |
| 3 2006, 2007 Free Software Foundation, Inc. | 3 2006, 2007, 2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of BFD, the Binary File Descriptor library. | 5 This file is part of BFD, the Binary File Descriptor library. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 28 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 #include "machine/vmparam.h" | 43 #include "machine/vmparam.h" |
| 44 | 44 |
| 45 #include <sys/param.h> | 45 #include <sys/param.h> |
| 46 #include <sys/dir.h> | 46 #include <sys/dir.h> |
| 47 #include <signal.h> | 47 #include <signal.h> |
| 48 #include <machine/reg.h> | 48 #include <machine/reg.h> |
| 49 #include <sys/user.h> /* After a.out.h */ | 49 #include <sys/user.h> /* After a.out.h */ |
| 50 #include <sys/file.h> | 50 #include <sys/file.h> |
| 51 | 51 |
| 52 static asection *make_bfd_asection | |
| 53 PARAMS ((bfd *, const char *, flagword, bfd_size_type, file_ptr, | |
| 54 unsigned int)); | |
| 55 static const bfd_target *hppabsd_core_core_file_p | |
| 56 PARAMS ((bfd *)); | |
| 57 static char *hppabsd_core_core_file_failing_command | |
| 58 PARAMS ((bfd *)); | |
| 59 static int hppabsd_core_core_file_failing_signal | |
| 60 PARAMS ((bfd *)); | |
| 61 #define hppabsd_core_core_file_matches_executable_p generic_core_file_matches_ex
ecutable_p | 52 #define hppabsd_core_core_file_matches_executable_p generic_core_file_matches_ex
ecutable_p |
| 62 #define hppabsd_core_core_file_pid _bfd_nocore_core_file_pid | 53 #define hppabsd_core_core_file_pid _bfd_nocore_core_file_pid |
| 63 static void swap_abort | |
| 64 PARAMS ((void)); | |
| 65 | 54 |
| 66 /* These are stored in the bfd's tdata. */ | 55 /* These are stored in the bfd's tdata. */ |
| 67 | 56 |
| 68 struct hppabsd_core_struct | 57 struct hppabsd_core_struct |
| 69 { | 58 { |
| 70 int sig; | 59 int sig; |
| 71 char cmd[MAXCOMLEN + 1]; | 60 char cmd[MAXCOMLEN + 1]; |
| 72 asection *data_section; | 61 asection *data_section; |
| 73 asection *stack_section; | 62 asection *stack_section; |
| 74 asection *reg_section; | 63 asection *reg_section; |
| 75 }; | 64 }; |
| 76 | 65 |
| 77 #define core_hdr(bfd) ((bfd)->tdata.hppabsd_core_data) | 66 #define core_hdr(bfd) ((bfd)->tdata.hppabsd_core_data) |
| 78 #define core_signal(bfd) (core_hdr(bfd)->sig) | 67 #define core_signal(bfd) (core_hdr(bfd)->sig) |
| 79 #define core_command(bfd) (core_hdr(bfd)->cmd) | 68 #define core_command(bfd) (core_hdr(bfd)->cmd) |
| 80 #define core_datasec(bfd) (core_hdr(bfd)->data_section) | 69 #define core_datasec(bfd) (core_hdr(bfd)->data_section) |
| 81 #define core_stacksec(bfd) (core_hdr(bfd)->stack_section) | 70 #define core_stacksec(bfd) (core_hdr(bfd)->stack_section) |
| 82 #define core_regsec(bfd) (core_hdr(bfd)->reg_section) | 71 #define core_regsec(bfd) (core_hdr(bfd)->reg_section) |
| 83 | 72 |
| 84 static asection * | 73 static asection * |
| 85 make_bfd_asection (abfd, name, flags, size, offset, alignment_power) | 74 make_bfd_asection (bfd *abfd, |
| 86 bfd *abfd; | 75 » » const char *name, |
| 87 const char *name; | 76 » » flagword flags, |
| 88 flagword flags; | 77 » » bfd_size_type size, |
| 89 bfd_size_type size; | 78 » » file_ptr offset, |
| 90 file_ptr offset; | 79 » » unsigned int alignment_power) |
| 91 unsigned int alignment_power; | |
| 92 { | 80 { |
| 93 asection *asect; | 81 asection *asect; |
| 94 | 82 |
| 95 asect = bfd_make_section_with_flags (abfd, name, flags); | 83 asect = bfd_make_section_with_flags (abfd, name, flags); |
| 96 if (!asect) | 84 if (!asect) |
| 97 return NULL; | 85 return NULL; |
| 98 | 86 |
| 99 asect->size = size; | 87 asect->size = size; |
| 100 asect->filepos = offset; | 88 asect->filepos = offset; |
| 101 asect->alignment_power = alignment_power; | 89 asect->alignment_power = alignment_power; |
| 102 | 90 |
| 103 return asect; | 91 return asect; |
| 104 } | 92 } |
| 105 | 93 |
| 106 static const bfd_target * | 94 static const bfd_target * |
| 107 hppabsd_core_core_file_p (abfd) | 95 hppabsd_core_core_file_p (bfd *abfd) |
| 108 bfd *abfd; | |
| 109 { | 96 { |
| 110 int val; | 97 int val; |
| 111 struct user u; | 98 struct user u; |
| 112 struct hppabsd_core_struct *coredata; | 99 struct hppabsd_core_struct *coredata; |
| 113 int clicksz; | 100 int clicksz; |
| 114 | 101 |
| 115 /* Try to read in the u-area. We will need information from this | 102 /* Try to read in the u-area. We will need information from this |
| 116 to know how to grok the rest of the core structures. */ | 103 to know how to grok the rest of the core structures. */ |
| 117 val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); | 104 val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); |
| 118 if (val != sizeof u) | 105 if (val != sizeof u) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 182 |
| 196 strncpy (core_command (abfd), u.u_comm, MAXCOMLEN + 1); | 183 strncpy (core_command (abfd), u.u_comm, MAXCOMLEN + 1); |
| 197 core_signal (abfd) = u.u_code; | 184 core_signal (abfd) = u.u_code; |
| 198 return abfd->xvec; | 185 return abfd->xvec; |
| 199 | 186 |
| 200 fail: | 187 fail: |
| 201 bfd_release (abfd, abfd->tdata.any); | 188 bfd_release (abfd, abfd->tdata.any); |
| 202 abfd->tdata.any = NULL; | 189 abfd->tdata.any = NULL; |
| 203 bfd_section_list_clear (abfd); | 190 bfd_section_list_clear (abfd); |
| 204 return NULL; | 191 return NULL; |
error: old chunk mismatch |
None
| OLD | NEW |