1 |
/* BFD backend for core files which use the ptrace_user structure |
/* BFD backend for core files which use the ptrace_user structure |
2 |
Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002 |
Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
The structure of this file is based on trad-core.c written by John Gilmore |
The structure of this file is based on trad-core.c written by John Gilmore |
5 |
of Cygnus Support. |
of Cygnus Support. |
49 |
/* forward declarations */ |
/* forward declarations */ |
50 |
|
|
51 |
const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd)); |
const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd)); |
52 |
char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd)); |
char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd)); |
53 |
int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); |
int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); |
54 |
boolean ptrace_unix_core_file_matches_executable_p |
bfd_boolean ptrace_unix_core_file_matches_executable_p |
55 |
PARAMS ((bfd *core_bfd, bfd *exec_bfd)); |
PARAMS ((bfd *core_bfd, bfd *exec_bfd)); |
56 |
static void swap_abort PARAMS ((void)); |
static void swap_abort PARAMS ((void)); |
57 |
|
|
|
/* ARGSUSED */ |
|
58 |
const bfd_target * |
const bfd_target * |
59 |
ptrace_unix_core_file_p (abfd) |
ptrace_unix_core_file_p (abfd) |
60 |
bfd *abfd; |
bfd *abfd; |
108 |
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; |
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; |
109 |
core_regsec (abfd)->flags = SEC_HAS_CONTENTS; |
core_regsec (abfd)->flags = SEC_HAS_CONTENTS; |
110 |
|
|
111 |
core_datasec (abfd)->_raw_size = u.pt_dsize; |
core_datasec (abfd)->size = u.pt_dsize; |
112 |
core_stacksec (abfd)->_raw_size = u.pt_ssize; |
core_stacksec (abfd)->size = u.pt_ssize; |
113 |
core_regsec (abfd)->_raw_size = sizeof (u); |
core_regsec (abfd)->size = sizeof (u); |
114 |
|
|
115 |
core_datasec (abfd)->vma = u.pt_o_data_start; |
core_datasec (abfd)->vma = u.pt_o_data_start; |
116 |
core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize; |
core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize; |
145 |
return 0; |
return 0; |
146 |
} |
} |
147 |
|
|
|
/* ARGSUSED */ |
|
148 |
int |
int |
149 |
ptrace_unix_core_file_failing_signal (abfd) |
ptrace_unix_core_file_failing_signal (abfd) |
150 |
bfd *abfd; |
bfd *abfd; |
152 |
return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num; |
return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num; |
153 |
} |
} |
154 |
|
|
155 |
/* ARGSUSED */ |
bfd_boolean |
|
boolean |
|
156 |
ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd) |
ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd) |
157 |
bfd *core_bfd, *exec_bfd; |
bfd *core_bfd, *exec_bfd; |
158 |
{ |
{ |
159 |
/* FIXME: Use pt_timdat field of the ptrace_user structure to match |
/* FIXME: Use pt_timdat field of the ptrace_user structure to match |
160 |
the date of the executable */ |
the date of the executable */ |
161 |
return true; |
return TRUE; |
162 |
} |
} |
163 |
|
|
164 |
/* If somebody calls any byte-swapping routines, shoot them. */ |
/* If somebody calls any byte-swapping routines, shoot them. */ |
167 |
{ |
{ |
168 |
abort (); /* This way doesn't require any declaration for ANSI to fuck up */ |
abort (); /* This way doesn't require any declaration for ANSI to fuck up */ |
169 |
} |
} |
170 |
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort ) |
|
171 |
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort ) |
#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) |
172 |
#define NO_SIGNED_GET \ |
#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) |
173 |
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort ) |
#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) |
174 |
|
#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) |
175 |
|
#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) |
176 |
|
#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) |
177 |
|
|
178 |
const bfd_target ptrace_core_vec = |
const bfd_target ptrace_core_vec = |
179 |
{ |
{ |
188 |
0, /* symbol prefix */ |
0, /* symbol prefix */ |
189 |
' ', /* ar_pad_char */ |
' ', /* ar_pad_char */ |
190 |
16, /* ar_max_namelen */ |
16, /* ar_max_namelen */ |
191 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */ |
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */ |
192 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */ |
NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ |
193 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */ |
NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ |
194 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */ |
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */ |
195 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */ |
NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ |
196 |
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */ |
NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ |
197 |
|
|
198 |
{ /* bfd_check_format */ |
{ /* bfd_check_format */ |
199 |
_bfd_dummy_target, /* unknown format */ |
_bfd_dummy_target, /* unknown format */ |
200 |
_bfd_dummy_target, /* object file */ |
_bfd_dummy_target, /* object file */ |
201 |
_bfd_dummy_target, /* archive */ |
_bfd_dummy_target, /* archive */ |
202 |
ptrace_unix_core_file_p /* a core file */ |
ptrace_unix_core_file_p /* a core file */ |
203 |
}, |
}, |
204 |
{ /* bfd_set_format */ |
{ /* bfd_set_format */ |
205 |
bfd_false, bfd_false, |
bfd_false, bfd_false, |
206 |
bfd_false, bfd_false |
bfd_false, bfd_false |
207 |
}, |
}, |
208 |
{ /* bfd_write_contents */ |
{ /* bfd_write_contents */ |
209 |
bfd_false, bfd_false, |
bfd_false, bfd_false, |
210 |
bfd_false, bfd_false |
bfd_false, bfd_false |
211 |
}, |
}, |
212 |
|
|
213 |
BFD_JUMP_TABLE_GENERIC (_bfd_generic), |
BFD_JUMP_TABLE_GENERIC (_bfd_generic), |
214 |
BFD_JUMP_TABLE_COPY (_bfd_generic), |
BFD_JUMP_TABLE_COPY (_bfd_generic), |
215 |
BFD_JUMP_TABLE_CORE (ptrace_unix), |
BFD_JUMP_TABLE_CORE (ptrace_unix), |
216 |
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), |
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), |
217 |
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), |
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), |
218 |
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), |
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), |
219 |
BFD_JUMP_TABLE_WRITE (_bfd_generic), |
BFD_JUMP_TABLE_WRITE (_bfd_generic), |
220 |
BFD_JUMP_TABLE_LINK (_bfd_nolink), |
BFD_JUMP_TABLE_LINK (_bfd_nolink), |
221 |
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
222 |
|
|
223 |
NULL, |
NULL, |
224 |
|
|
225 |
(PTR) 0 /* backend_data */ |
(PTR) 0 /* backend_data */ |
226 |
}; |
}; |
227 |
|
|
228 |
#endif /* PTRACE_CORE */ |
#endif /* PTRACE_CORE */ |