Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: bfd/aix386-core.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bfd/aclocal.m4 ('k') | bfd/aout-arm.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* BFD back-end for AIX on PS/2 core files. 1 /* BFD back-end for AIX on PS/2 core files.
2 This was based on trad-core.c, which was written by John Gilmore of 2 This was based on trad-core.c, which was written by John Gilmore of
3 Cygnus Support. 3 Cygnus Support.
4 Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 4 Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000,
5 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011 5 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011, 2012
6 Free Software Foundation, Inc. 6 Free Software Foundation, Inc.
7 Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>. 7 Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
8 Converted to back end form by Ian Lance Taylor <ian@cygnus.com>. 8 Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
9 9
10 This file is part of BFD, the Binary File Descriptor library. 10 This file is part of BFD, the Binary File Descriptor library.
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or 14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version. 15 (at your option) any later version.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #define core_hdr(bfd) \ 52 #define core_hdr(bfd) \
53 (((bfd->tdata.trad_core_data))->hdr) 53 (((bfd->tdata.trad_core_data))->hdr)
54 #define core_section(bfd,n) \ 54 #define core_section(bfd,n) \
55 (((bfd)->tdata.trad_core_data)->sections[n]) 55 (((bfd)->tdata.trad_core_data)->sections[n])
56 #define core_regsec(bfd) \ 56 #define core_regsec(bfd) \
57 (((bfd)->tdata.trad_core_data)->reg_section) 57 (((bfd)->tdata.trad_core_data)->reg_section)
58 #define core_reg2sec(bfd) \ 58 #define core_reg2sec(bfd) \
59 (((bfd)->tdata.trad_core_data)->reg2_section) 59 (((bfd)->tdata.trad_core_data)->reg2_section)
60 60
61 /* These are stored in the bfd's tdata. */ 61 /* These are stored in the bfd's tdata. */
62 struct trad_core_struct { 62 struct trad_core_struct
63 {
63 struct corehdr *hdr; /* core file header */ 64 struct corehdr *hdr; /* core file header */
64 asection *reg_section; 65 asection *reg_section;
65 asection *reg2_section; 66 asection *reg2_section;
66 asection *sections[MAX_CORE_SEGS]; 67 asection *sections[MAX_CORE_SEGS];
67 }; 68 };
68 69
69 static void swap_abort PARAMS ((void));
70
71 static const bfd_target * 70 static const bfd_target *
72 aix386_core_file_p (abfd) 71 aix386_core_file_p (bfd *abfd)
73 bfd *abfd;
74 { 72 {
75 int i, n; 73 int i, n;
76 unsigned char longbuf[4]; /* Raw bytes of various header fields */ 74 unsigned char longbuf[4]; /* Raw bytes of various header fields */
77 bfd_size_type core_size = sizeof (struct corehdr); 75 bfd_size_type core_size = sizeof (struct corehdr);
78 bfd_size_type amt; 76 bfd_size_type amt;
79 struct corehdr *core; 77 struct corehdr *core;
80 struct mergem { 78 struct mergem
79 {
81 struct trad_core_struct coredata; 80 struct trad_core_struct coredata;
82 struct corehdr internal_core; 81 struct corehdr internal_core;
83 } *mergem; 82 } *mergem;
84 flagword flags; 83 flagword flags;
85 84
86 amt = sizeof (longbuf); 85 amt = sizeof (longbuf);
87 if (bfd_bread ((PTR) longbuf, amt, abfd) != amt) 86 if (bfd_bread (longbuf, amt, abfd) != amt)
88 { 87 {
89 if (bfd_get_error () != bfd_error_system_call) 88 if (bfd_get_error () != bfd_error_system_call)
90 bfd_set_error (bfd_error_wrong_format); 89 bfd_set_error (bfd_error_wrong_format);
91 return 0; 90 return 0;
92 } 91 }
93 92
94 if (strncmp (longbuf, COR_MAGIC, 4)) 93 if (strncmp (longbuf, COR_MAGIC, 4))
95 return 0; 94 return 0;
96 95
97 if (bfd_seek (abfd, (file_ptr) 0, 0) != 0) 96 if (bfd_seek (abfd, (file_ptr) 0, 0) != 0)
98 return 0; 97 return 0;
99 98
100 amt = sizeof (struct mergem); 99 amt = sizeof (struct mergem);
101 mergem = (struct mergem *) bfd_zalloc (abfd, amt); 100 mergem = (struct mergem *) bfd_zalloc (abfd, amt);
102 if (mergem == NULL) 101 if (mergem == NULL)
103 return 0; 102 return 0;
104 103
105 core = &mergem->internal_core; 104 core = &mergem->internal_core;
106 105
107 if ((bfd_bread ((PTR) core, core_size, abfd)) != core_size) 106 if ((bfd_bread (core, core_size, abfd)) != core_size)
108 { 107 {
109 if (bfd_get_error () != bfd_error_system_call) 108 if (bfd_get_error () != bfd_error_system_call)
110 bfd_set_error (bfd_error_wrong_format); 109 bfd_set_error (bfd_error_wrong_format);
111 loser: 110 loser:
112 bfd_release (abfd, (char *) mergem); 111 bfd_release (abfd, (char *) mergem);
113 abfd->tdata.any = NULL; 112 abfd->tdata.any = NULL;
114 bfd_section_list_clear (abfd); 113 bfd_section_list_clear (abfd);
115 return 0; 114 return 0;
116 } 115 }
117 116
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 core_section (abfd, n)->vma = core->cd_segs[i].cs_address; 188 core_section (abfd, n)->vma = core->cd_segs[i].cs_address;
190 core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset; 189 core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset;
191 core_section (abfd, n)->alignment_power = 2; 190 core_section (abfd, n)->alignment_power = 2;
192 n++; 191 n++;
193 } 192 }
194 193
195 return abfd->xvec; 194 return abfd->xvec;
196 } 195 }
197 196
198 static char * 197 static char *
199 aix386_core_file_failing_command (abfd) 198 aix386_core_file_failing_command (bfd *abfd)
200 bfd *abfd;
201 { 199 {
202 return core_hdr (abfd)->cd_comm; 200 return core_hdr (abfd)->cd_comm;
203 } 201 }
204 202
205 static int 203 static int
206 aix386_core_file_failing_signal (abfd) 204 aix386_core_file_failing_signal (bfd *abfd)
207 bfd *abfd;
208 { 205 {
209 return core_hdr (abfd)->cd_cursig; 206 return core_hdr (abfd)->cd_cursig;
210 } 207 }
211 208
212 #define aix386_core_file_matches_executable_p generic_core_file_matches_executab le_p 209 #define aix386_core_file_matches_executable_p generic_core_file_matches_executab le_p
213 210
214 #define aix386_core_file_pid _bfd_nocore_core_file_pid 211 #define aix386_core_file_pid _bfd_nocore_core_file_pid
215 212
216 /* If somebody calls any byte-swapping routines, shoot them. */ 213 /* If somebody calls any byte-swapping routines, shoot them. */
217 214
218 static void 215 static void
219 swap_abort () 216 swap_abort (void)
220 { 217 {
221 /* This way doesn't require any declaration for ANSI to fuck up. */ 218 /* This way doesn't require any declaration for ANSI to fuck up. */
222 abort (); 219 abort ();
223 } 220 }
224 221
225 #define NO_GET ((bfd_vma (*) (const void *)) swap_abort) 222 #define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
226 #define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) 223 #define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
227 #define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) 224 #define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
228 #define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) 225 #define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
229 #define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) 226 #define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
230 #define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) 227 #define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
231 228
232 const bfd_target aix386_core_vec = { 229 const bfd_target aix386_core_vec =
230 {
233 "aix386-core", 231 "aix386-core",
234 bfd_target_unknown_flavour, 232 bfd_target_unknown_flavour,
235 BFD_ENDIAN_BIG, /* target byte order */ 233 BFD_ENDIAN_BIG, /* target byte order */
236 BFD_ENDIAN_BIG, /* target headers byte order */ 234 BFD_ENDIAN_BIG, /* target headers byte order */
237 (HAS_RELOC | EXEC_P | /* object flags */ 235 (HAS_RELOC | EXEC_P | /* object flags */
238 HAS_LINENO | HAS_DEBUG | 236 HAS_LINENO | HAS_DEBUG |
239 HAS_SYMS | HAS_LOCALS | WP_TEXT), 237 HAS_SYMS | HAS_LOCALS | WP_TEXT),
240 238
241 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 239 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
242 0, /* leading underscore */ 240 0, /* leading underscore */
(...skipping 19 matching lines...) Expand all
262 BFD_JUMP_TABLE_CORE (aix386), 260 BFD_JUMP_TABLE_CORE (aix386),
263 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), 261 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
264 BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), 262 BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
265 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), 263 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
266 BFD_JUMP_TABLE_WRITE (_bfd_generic), 264 BFD_JUMP_TABLE_WRITE (_bfd_generic),
267 BFD_JUMP_TABLE_LINK (_bfd_nolink), 265 BFD_JUMP_TABLE_LINK (_bfd_nolink),
268 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 266 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
269 267
270 NULL, 268 NULL,
271 269
272 (PTR) 0 270 NULL
273 }; 271 };
OLDNEW
« no previous file with comments | « bfd/aclocal.m4 ('k') | bfd/aout-arm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698