1 /* OBSOLETE /* Acorn Risc Machine host machine support. */
2 /* OBSOLETE Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. */
4 /* OBSOLETE This file is part of GDB. */
6 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
7 /* OBSOLETE it under the terms of the GNU General Public License as published by */
8 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
9 /* OBSOLETE (at your option) any later version. */
11 /* OBSOLETE This program is distributed in the hope that it will be useful, */
12 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* OBSOLETE GNU General Public License for more details. */
16 /* OBSOLETE You should have received a copy of the GNU General Public License */
17 /* OBSOLETE along with this program; if not, write to the Free Software */
18 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
19 /* OBSOLETE Boston, MA 02111-1307, USA. *x/ */
21 /* OBSOLETE #include "defs.h" */
22 /* OBSOLETE #include "frame.h" */
23 /* OBSOLETE #include "inferior.h" */
24 /* OBSOLETE #include "opcode/arm.h" */
26 /* OBSOLETE #include <sys/param.h> */
27 /* OBSOLETE #include <sys/dir.h> */
28 /* OBSOLETE #include <signal.h> */
29 /* OBSOLETE #include <sys/ioctl.h> */
30 /* OBSOLETE #include <sys/ptrace.h> */
31 /* OBSOLETE #include <machine/reg.h> */
33 /* OBSOLETE #define N_TXTADDR(hdr) 0x8000 */
34 /* OBSOLETE #define N_DATADDR(hdr) (hdr.a_text + 0x8000) */
36 /* OBSOLETE #include "gdbcore.h" */
38 /* OBSOLETE #include <sys/user.h> /* After a.out.h *x/ */
39 /* OBSOLETE #include <sys/file.h> */
40 /* OBSOLETE #include "gdb_stat.h" */
42 /* OBSOLETE #include <errno.h> */
45 /* OBSOLETE fetch_inferior_registers (regno) */
46 /* OBSOLETE int regno; /* Original value discarded *x/ */
48 /* OBSOLETE register unsigned int regaddr; */
49 /* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */
50 /* OBSOLETE register int i; */
52 /* OBSOLETE struct user u; */
53 /* OBSOLETE unsigned int offset = (char *) &u.u_ar0 - (char *) &u; */
54 /* OBSOLETE offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) */
55 /* OBSOLETE - KERNEL_U_ADDR; */
57 /* OBSOLETE registers_fetched (); */
59 /* OBSOLETE for (regno = 0; regno < 16; regno++) */
61 /* OBSOLETE regaddr = offset + regno * 4; */
62 /* OBSOLETE *(int *) &buf[0] = ptrace (PT_READ_U, inferior_pid, */
63 /* OBSOLETE (PTRACE_ARG3_TYPE) regaddr, 0); */
64 /* OBSOLETE if (regno == PC_REGNUM) */
65 /* OBSOLETE *(int *) &buf[0] = GET_PC_PART (*(int *) &buf[0]); */
66 /* OBSOLETE supply_register (regno, buf); */
68 /* OBSOLETE *(int *) &buf[0] = ptrace (PT_READ_U, inferior_pid, */
69 /* OBSOLETE (PTRACE_ARG3_TYPE) (offset + PC * 4), 0); */
70 /* OBSOLETE supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc *x/ */
72 /* OBSOLETE /* read the floating point registers *x/ */
73 /* OBSOLETE offset = (char *) &u.u_fp_regs - (char *) &u; */
74 /* OBSOLETE *(int *) buf = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0); */
75 /* OBSOLETE supply_register (FPS_REGNUM, buf); */
76 /* OBSOLETE for (regno = 16; regno < 24; regno++) */
78 /* OBSOLETE regaddr = offset + 4 + 12 * (regno - 16); */
79 /* OBSOLETE for (i = 0; i < 12; i += sizeof (int)) */
80 /* OBSOLETE *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, */
81 /* OBSOLETE (PTRACE_ARG3_TYPE) (regaddr + i), 0); */
82 /* OBSOLETE supply_register (regno, buf); */
86 /* OBSOLETE /* Store our register values back into the inferior. */
87 /* OBSOLETE If REGNO is -1, do this for all registers. */
88 /* OBSOLETE Otherwise, REGNO specifies which register (so we can save time). *x/ */
91 /* OBSOLETE store_inferior_registers (regno) */
92 /* OBSOLETE int regno; */
94 /* OBSOLETE register unsigned int regaddr; */
95 /* OBSOLETE char buf[80]; */
97 /* OBSOLETE struct user u; */
98 /* OBSOLETE unsigned long value; */
99 /* OBSOLETE unsigned int offset = (char *) &u.u_ar0 - (char *) &u; */
100 /* OBSOLETE offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) */
101 /* OBSOLETE - KERNEL_U_ADDR; */
103 /* OBSOLETE if (regno >= 0) */
105 /* OBSOLETE if (regno >= 16) */
106 /* OBSOLETE return; */
107 /* OBSOLETE regaddr = offset + 4 * regno; */
108 /* OBSOLETE errno = 0; */
109 /* OBSOLETE value = read_register (regno); */
110 /* OBSOLETE if (regno == PC_REGNUM) */
111 /* OBSOLETE value = SET_PC_PART (read_register (PS_REGNUM), value); */
112 /* OBSOLETE ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); */
113 /* OBSOLETE if (errno != 0) */
115 /* OBSOLETE sprintf (buf, "writing register number %d", regno); */
116 /* OBSOLETE perror_with_name (buf); */
120 /* OBSOLETE for (regno = 0; regno < 15; regno++) */
122 /* OBSOLETE regaddr = offset + regno * 4; */
123 /* OBSOLETE errno = 0; */
124 /* OBSOLETE value = read_register (regno); */
125 /* OBSOLETE if (regno == PC_REGNUM) */
126 /* OBSOLETE value = SET_PC_PART (read_register (PS_REGNUM), value); */
127 /* OBSOLETE ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); */
128 /* OBSOLETE if (errno != 0) */
130 /* OBSOLETE sprintf (buf, "writing all regs, number %d", regno); */
131 /* OBSOLETE perror_with_name (buf); */
136 /* OBSOLETE /* Work with core dump and executable files, for GDB. */
137 /* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. *x/ */
139 /* OBSOLETE /* Structure to describe the chain of shared libraries used */
140 /* OBSOLETE by the execfile. */
141 /* OBSOLETE e.g. prog shares Xt which shares X11 which shares c. *x/ */
143 /* OBSOLETE struct shared_library */
145 /* OBSOLETE struct exec_header header; */
146 /* OBSOLETE char name[SHLIBLEN]; */
147 /* OBSOLETE CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file *x/ */
148 /* OBSOLETE long data_offset; /* offset of data section in file *x/ */
149 /* OBSOLETE int chan; /* file descriptor for the file *x/ */
150 /* OBSOLETE struct shared_library *shares; /* library this one shares *x/ */
152 /* OBSOLETE static struct shared_library *shlib = 0; */
154 /* OBSOLETE /* Hook for `exec_file_command' command to call. *x/ */
156 /* OBSOLETE extern void (*exec_file_display_hook) (); */
158 /* OBSOLETE static CORE_ADDR unshared_text_start; */
160 /* OBSOLETE /* extended header from exec file (for shared library info) *x/ */
162 /* OBSOLETE static struct exec_header exec_header; */
165 /* OBSOLETE core_file_command (filename, from_tty) */
166 /* OBSOLETE char *filename; */
167 /* OBSOLETE int from_tty; */
169 /* OBSOLETE int val; */
171 /* OBSOLETE /* Discard all vestiges of any previous core file */
172 /* OBSOLETE and mark data and stack spaces as empty. *x/ */
174 /* OBSOLETE if (corefile) */
175 /* OBSOLETE xfree (corefile); */
176 /* OBSOLETE corefile = 0; */
178 /* OBSOLETE if (corechan >= 0) */
179 /* OBSOLETE close (corechan); */
180 /* OBSOLETE corechan = -1; */
182 /* OBSOLETE data_start = 0; */
183 /* OBSOLETE data_end = 0; */
184 /* OBSOLETE stack_start = STACK_END_ADDR; */
185 /* OBSOLETE stack_end = STACK_END_ADDR; */
187 /* OBSOLETE /* Now, if a new core file was specified, open it and digest it. *x/ */
189 /* OBSOLETE if (filename) */
191 /* OBSOLETE filename = tilde_expand (filename); */
192 /* OBSOLETE make_cleanup (xfree, filename); */
194 /* OBSOLETE if (have_inferior_p ()) */
195 /* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */
196 /* OBSOLETE corechan = open (filename, O_RDONLY, 0); */
197 /* OBSOLETE if (corechan < 0) */
198 /* OBSOLETE perror_with_name (filename); */
199 /* OBSOLETE /* 4.2-style (and perhaps also sysV-style) core dump file. *x/ */
201 /* OBSOLETE struct user u; */
203 /* OBSOLETE unsigned int reg_offset, fp_reg_offset; */
205 /* OBSOLETE val = myread (corechan, &u, sizeof u); */
206 /* OBSOLETE if (val < 0) */
207 /* OBSOLETE perror_with_name ("Not a core file: reading upage"); */
208 /* OBSOLETE if (val != sizeof u) */
209 /* OBSOLETE error ("Not a core file: could only read %d bytes", val); */
211 /* OBSOLETE /* We are depending on exec_file_command having been called */
212 /* OBSOLETE previously to set exec_data_start. Since the executable */
213 /* OBSOLETE and the core file share the same text segment, the address */
214 /* OBSOLETE of the data segment will be the same in both. *x/ */
215 /* OBSOLETE data_start = exec_data_start; */
217 /* OBSOLETE data_end = data_start + NBPG * u.u_dsize; */
218 /* OBSOLETE stack_start = stack_end - NBPG * u.u_ssize; */
219 /* OBSOLETE data_offset = NBPG * UPAGES; */
220 /* OBSOLETE stack_offset = NBPG * (UPAGES + u.u_dsize); */
222 /* OBSOLETE /* Some machines put an absolute address in here and some put */
223 /* OBSOLETE the offset in the upage of the regs. *x/ */
224 /* OBSOLETE reg_offset = (int) u.u_ar0; */
225 /* OBSOLETE if (reg_offset > NBPG * UPAGES) */
226 /* OBSOLETE reg_offset -= KERNEL_U_ADDR; */
227 /* OBSOLETE fp_reg_offset = (char *) &u.u_fp_regs - (char *) &u; */
229 /* OBSOLETE /* I don't know where to find this info. */
230 /* OBSOLETE So, for now, mark it as not available. *x/ */
231 /* OBSOLETE N_SET_MAGIC (core_aouthdr, 0); */
233 /* OBSOLETE /* Read the register values out of the core file and store */
234 /* OBSOLETE them where `read_register' will find them. *x/ */
237 /* OBSOLETE register int regno; */
239 /* OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) */
241 /* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */
243 /* OBSOLETE if (regno < 16) */
244 /* OBSOLETE val = lseek (corechan, reg_offset + 4 * regno, 0); */
245 /* OBSOLETE else if (regno < 24) */
246 /* OBSOLETE val = lseek (corechan, fp_reg_offset + 4 + 12 * (regno - 24), 0); */
247 /* OBSOLETE else if (regno == 24) */
248 /* OBSOLETE val = lseek (corechan, fp_reg_offset, 0); */
249 /* OBSOLETE else if (regno == 25) */
250 /* OBSOLETE val = lseek (corechan, reg_offset + 4 * PC, 0); */
251 /* OBSOLETE if (val < 0 */
252 /* OBSOLETE || (val = myread (corechan, buf, sizeof buf)) < 0) */
254 /* OBSOLETE char *buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) */
255 /* OBSOLETE + 30); */
256 /* OBSOLETE strcpy (buffer, "Reading register "); */
257 /* OBSOLETE strcat (buffer, REGISTER_NAME (regno)); */
259 /* OBSOLETE perror_with_name (buffer); */
262 /* OBSOLETE if (regno == PC_REGNUM) */
263 /* OBSOLETE *(int *) buf = GET_PC_PART (*(int *) buf); */
264 /* OBSOLETE supply_register (regno, buf); */
268 /* OBSOLETE if (filename[0] == '/') */
269 /* OBSOLETE corefile = savestring (filename, strlen (filename)); */
272 /* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */
275 /* OBSOLETE flush_cached_frames (); */
276 /* OBSOLETE select_frame (get_current_frame (), 0); */
277 /* OBSOLETE validate_files (); */
279 /* OBSOLETE else if (from_tty) */
280 /* OBSOLETE printf ("No core file now.\n"); */
284 /* OBSOLETE /* Work with core dump and executable files, for GDB. */
285 /* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. *x/ */
287 /* OBSOLETE /* Structure to describe the chain of shared libraries used */
288 /* OBSOLETE by the execfile. */
289 /* OBSOLETE e.g. prog shares Xt which shares X11 which shares c. *x/ */
291 /* OBSOLETE struct shared_library */
293 /* OBSOLETE struct exec_header header; */
294 /* OBSOLETE char name[SHLIBLEN]; */
295 /* OBSOLETE CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file *x/ */
296 /* OBSOLETE long data_offset; /* offset of data section in file *x/ */
297 /* OBSOLETE int chan; /* file descriptor for the file *x/ */
298 /* OBSOLETE struct shared_library *shares; /* library this one shares *x/ */
300 /* OBSOLETE static struct shared_library *shlib = 0; */
302 /* OBSOLETE /* Hook for `exec_file_command' command to call. *x/ */
304 /* OBSOLETE extern void (*exec_file_display_hook) (); */
306 /* OBSOLETE static CORE_ADDR unshared_text_start; */
308 /* OBSOLETE /* extended header from exec file (for shared library info) *x/ */
310 /* OBSOLETE static struct exec_header exec_header; */
313 /* OBSOLETE exec_file_command (filename, from_tty) */
314 /* OBSOLETE char *filename; */
315 /* OBSOLETE int from_tty; */
317 /* OBSOLETE int val; */
319 /* OBSOLETE /* Eliminate all traces of old exec file. */
320 /* OBSOLETE Mark text segment as empty. *x/ */
322 /* OBSOLETE if (execfile) */
323 /* OBSOLETE xfree (execfile); */
324 /* OBSOLETE execfile = 0; */
325 /* OBSOLETE data_start = 0; */
326 /* OBSOLETE data_end -= exec_data_start; */
327 /* OBSOLETE text_start = 0; */
328 /* OBSOLETE unshared_text_start = 0; */
329 /* OBSOLETE text_end = 0; */
330 /* OBSOLETE exec_data_start = 0; */
331 /* OBSOLETE exec_data_end = 0; */
332 /* OBSOLETE if (execchan >= 0) */
333 /* OBSOLETE close (execchan); */
334 /* OBSOLETE execchan = -1; */
335 /* OBSOLETE if (shlib) */
337 /* OBSOLETE close_shared_library (shlib); */
338 /* OBSOLETE shlib = 0; */
341 /* OBSOLETE /* Now open and digest the file the user requested, if any. *x/ */
343 /* OBSOLETE if (filename) */
345 /* OBSOLETE filename = tilde_expand (filename); */
346 /* OBSOLETE make_cleanup (xfree, filename); */
348 /* OBSOLETE execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, */
349 /* OBSOLETE &execfile); */
350 /* OBSOLETE if (execchan < 0) */
351 /* OBSOLETE perror_with_name (filename); */
354 /* OBSOLETE struct stat st_exec; */
356 /* OBSOLETE #ifdef HEADER_SEEK_FD */
357 /* OBSOLETE HEADER_SEEK_FD (execchan); */
358 /* OBSOLETE #endif */
360 /* OBSOLETE val = myread (execchan, &exec_header, sizeof exec_header); */
361 /* OBSOLETE exec_aouthdr = exec_header.a_exec; */
363 /* OBSOLETE if (val < 0) */
364 /* OBSOLETE perror_with_name (filename); */
366 /* OBSOLETE text_start = 0x8000; */
368 /* OBSOLETE /* Look for shared library if needed *x/ */
369 /* OBSOLETE if (exec_header.a_exec.a_magic & MF_USES_SL) */
370 /* OBSOLETE shlib = open_shared_library (exec_header.a_shlibname, text_start); */
372 /* OBSOLETE text_offset = N_TXTOFF (exec_aouthdr); */
373 /* OBSOLETE exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text; */
375 /* OBSOLETE if (shlib) */
377 /* OBSOLETE unshared_text_start = shared_text_end (shlib) & ~0x7fff; */
378 /* OBSOLETE stack_start = shlib->header.a_exec.a_sldatabase; */
379 /* OBSOLETE stack_end = STACK_END_ADDR; */
382 /* OBSOLETE unshared_text_start = 0x8000; */
383 /* OBSOLETE text_end = unshared_text_start + exec_aouthdr.a_text; */
385 /* OBSOLETE exec_data_start = unshared_text_start + exec_aouthdr.a_text; */
386 /* OBSOLETE exec_data_end = exec_data_start + exec_aouthdr.a_data; */
388 /* OBSOLETE data_start = exec_data_start; */
389 /* OBSOLETE data_end += exec_data_start; */
391 /* OBSOLETE fstat (execchan, &st_exec); */
392 /* OBSOLETE exec_mtime = st_exec.st_mtime; */
395 /* OBSOLETE validate_files (); */
397 /* OBSOLETE else if (from_tty) */
398 /* OBSOLETE printf ("No executable file now.\n"); */
400 /* OBSOLETE /* Tell display code (if any) about the changed file name. *x/ */
401 /* OBSOLETE if (exec_file_display_hook) */
402 /* OBSOLETE (*exec_file_display_hook) (filename); */
404 /* OBSOLETE #endif */
407 /* OBSOLETE /* Read from the program's memory (except for inferior processes). */
408 /* OBSOLETE This function is misnamed, since it only reads, never writes; and */
409 /* OBSOLETE since it will use the core file and/or executable file as necessary. */
411 /* OBSOLETE It should be extended to write as well as read, FIXME, for patching files. */
413 /* OBSOLETE Return 0 if address could be read, EIO if addresss out of bounds. *x/ */
416 /* OBSOLETE xfer_core_file (memaddr, myaddr, len) */
417 /* OBSOLETE CORE_ADDR memaddr; */
418 /* OBSOLETE char *myaddr; */
419 /* OBSOLETE int len; */
421 /* OBSOLETE register int i; */
422 /* OBSOLETE register int val; */
423 /* OBSOLETE int xferchan; */
424 /* OBSOLETE char **xferfile; */
425 /* OBSOLETE int fileptr; */
426 /* OBSOLETE int returnval = 0; */
428 /* OBSOLETE while (len > 0) */
430 /* OBSOLETE xferfile = 0; */
431 /* OBSOLETE xferchan = 0; */
433 /* OBSOLETE /* Determine which file the next bunch of addresses reside in, */
434 /* OBSOLETE and where in the file. Set the file's read/write pointer */
435 /* OBSOLETE to point at the proper place for the desired address */
436 /* OBSOLETE and set xferfile and xferchan for the correct file. */
438 /* OBSOLETE If desired address is nonexistent, leave them zero. */
440 /* OBSOLETE i is set to the number of bytes that can be handled */
441 /* OBSOLETE along with the next address. */
443 /* OBSOLETE We put the most likely tests first for efficiency. *x/ */
445 /* OBSOLETE /* Note that if there is no core file */
446 /* OBSOLETE data_start and data_end are equal. *x/ */
447 /* OBSOLETE if (memaddr >= data_start && memaddr < data_end) */
449 /* OBSOLETE i = min (len, data_end - memaddr); */
450 /* OBSOLETE fileptr = memaddr - data_start + data_offset; */
451 /* OBSOLETE xferfile = &corefile; */
452 /* OBSOLETE xferchan = corechan; */
454 /* OBSOLETE /* Note that if there is no core file */
455 /* OBSOLETE stack_start and stack_end define the shared library data. *x/ */
456 /* OBSOLETE else if (memaddr >= stack_start && memaddr < stack_end) */
458 /* OBSOLETE if (corechan < 0) */
460 /* OBSOLETE struct shared_library *lib; */
461 /* OBSOLETE for (lib = shlib; lib; lib = lib->shares) */
462 /* OBSOLETE if (memaddr >= lib->header.a_exec.a_sldatabase && */
463 /* OBSOLETE memaddr < lib->header.a_exec.a_sldatabase + */
464 /* OBSOLETE lib->header.a_exec.a_data) */
465 /* OBSOLETE break; */
466 /* OBSOLETE if (lib) */
468 /* OBSOLETE i = min (len, lib->header.a_exec.a_sldatabase + */
469 /* OBSOLETE lib->header.a_exec.a_data - memaddr); */
470 /* OBSOLETE fileptr = lib->data_offset + memaddr - */
471 /* OBSOLETE lib->header.a_exec.a_sldatabase; */
472 /* OBSOLETE xferfile = execfile; */
473 /* OBSOLETE xferchan = lib->chan; */
478 /* OBSOLETE i = min (len, stack_end - memaddr); */
479 /* OBSOLETE fileptr = memaddr - stack_start + stack_offset; */
480 /* OBSOLETE xferfile = &corefile; */
481 /* OBSOLETE xferchan = corechan; */
484 /* OBSOLETE else if (corechan < 0 */
485 /* OBSOLETE && memaddr >= exec_data_start && memaddr < exec_data_end) */
487 /* OBSOLETE i = min (len, exec_data_end - memaddr); */
488 /* OBSOLETE fileptr = memaddr - exec_data_start + exec_data_offset; */
489 /* OBSOLETE xferfile = &execfile; */
490 /* OBSOLETE xferchan = execchan; */
492 /* OBSOLETE else if (memaddr >= text_start && memaddr < text_end) */
494 /* OBSOLETE struct shared_library *lib; */
495 /* OBSOLETE for (lib = shlib; lib; lib = lib->shares) */
496 /* OBSOLETE if (memaddr >= lib->text_start && */
497 /* OBSOLETE memaddr < lib->text_start + lib->header.a_exec.a_text) */
498 /* OBSOLETE break; */
499 /* OBSOLETE if (lib) */
501 /* OBSOLETE i = min (len, lib->header.a_exec.a_text + */
502 /* OBSOLETE lib->text_start - memaddr); */
503 /* OBSOLETE fileptr = memaddr - lib->text_start + text_offset; */
504 /* OBSOLETE xferfile = &execfile; */
505 /* OBSOLETE xferchan = lib->chan; */
509 /* OBSOLETE i = min (len, text_end - memaddr); */
510 /* OBSOLETE fileptr = memaddr - unshared_text_start + text_offset; */
511 /* OBSOLETE xferfile = &execfile; */
512 /* OBSOLETE xferchan = execchan; */
515 /* OBSOLETE else if (memaddr < text_start) */
517 /* OBSOLETE i = min (len, text_start - memaddr); */
519 /* OBSOLETE else if (memaddr >= text_end */
520 /* OBSOLETE && memaddr < (corechan >= 0 ? data_start : exec_data_start)) */
522 /* OBSOLETE i = min (len, data_start - memaddr); */
524 /* OBSOLETE else if (corechan >= 0 */
525 /* OBSOLETE && memaddr >= data_end && memaddr < stack_start) */
527 /* OBSOLETE i = min (len, stack_start - memaddr); */
529 /* OBSOLETE else if (corechan < 0 && memaddr >= exec_data_end) */
531 /* OBSOLETE i = min (len, -memaddr); */
533 /* OBSOLETE else if (memaddr >= stack_end && stack_end != 0) */
535 /* OBSOLETE i = min (len, -memaddr); */
539 /* OBSOLETE /* Address did not classify into one of the known ranges. */
540 /* OBSOLETE This shouldn't happen; we catch the endpoints. *x/ */
541 /* OBSOLETE internal_error ("Bad case logic in xfer_core_file."); */
544 /* OBSOLETE /* Now we know which file to use. */
545 /* OBSOLETE Set up its pointer and transfer the data. *x/ */
546 /* OBSOLETE if (xferfile) */
548 /* OBSOLETE if (*xferfile == 0) */
549 /* OBSOLETE if (xferfile == &execfile) */
550 /* OBSOLETE error ("No program file to examine."); */
552 /* OBSOLETE error ("No core dump file or running program to examine."); */
553 /* OBSOLETE val = lseek (xferchan, fileptr, 0); */
554 /* OBSOLETE if (val < 0) */
555 /* OBSOLETE perror_with_name (*xferfile); */
556 /* OBSOLETE val = myread (xferchan, myaddr, i); */
557 /* OBSOLETE if (val < 0) */
558 /* OBSOLETE perror_with_name (*xferfile); */
560 /* OBSOLETE /* If this address is for nonexistent memory, */
561 /* OBSOLETE read zeros if reading, or do nothing if writing. */
562 /* OBSOLETE Actually, we never right. *x/ */
565 /* OBSOLETE memset (myaddr, '\0', i); */
566 /* OBSOLETE returnval = EIO; */
569 /* OBSOLETE memaddr += i; */
570 /* OBSOLETE myaddr += i; */
571 /* OBSOLETE len -= i; */
573 /* OBSOLETE return returnval; */
575 /* OBSOLETE #endif */