1 /* OBSOLETE /* Low level interface to ptrace, for GDB when running under Unix. */
2 /* OBSOLETE Copyright (C) 1986, 1987, 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, Boston, MA 02111-1307, USA. *x/ */
20 /* OBSOLETE #include "defs.h" */
21 /* OBSOLETE #include "frame.h" */
22 /* OBSOLETE #include "inferior.h" */
24 /* OBSOLETE #include <sys/param.h> */
25 /* OBSOLETE #include <sys/dir.h> */
26 /* OBSOLETE #include <signal.h> */
27 /* OBSOLETE #include <sys/user.h> */
28 /* OBSOLETE #include <sys/ioctl.h> */
29 /* OBSOLETE #include <fcntl.h> */
31 /* OBSOLETE #include "gdbcore.h" */
33 /* OBSOLETE #include <sys/file.h> */
34 /* OBSOLETE #include "gdb_stat.h" */
37 /* OBSOLETE /* Work with core dump and executable files, for GDB. */
38 /* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. *x/ */
41 /* OBSOLETE core_file_command (filename, from_tty) */
42 /* OBSOLETE char *filename; */
43 /* OBSOLETE int from_tty; */
45 /* OBSOLETE int val; */
46 /* OBSOLETE extern char registers[]; */
48 /* OBSOLETE /* Discard all vestiges of any previous core file */
49 /* OBSOLETE and mark data and stack spaces as empty. *x/ */
51 /* OBSOLETE if (corefile) */
52 /* OBSOLETE free (corefile); */
53 /* OBSOLETE corefile = 0; */
55 /* OBSOLETE if (corechan >= 0) */
56 /* OBSOLETE close (corechan); */
57 /* OBSOLETE corechan = -1; */
59 /* OBSOLETE data_start = 0; */
60 /* OBSOLETE data_end = 0; */
61 /* OBSOLETE stack_start = STACK_END_ADDR; */
62 /* OBSOLETE stack_end = STACK_END_ADDR; */
64 /* OBSOLETE /* Now, if a new core file was specified, open it and digest it. *x/ */
66 /* OBSOLETE if (filename) */
68 /* OBSOLETE filename = tilde_expand (filename); */
69 /* OBSOLETE make_cleanup (free, filename); */
71 /* OBSOLETE if (have_inferior_p ()) */
72 /* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */
73 /* OBSOLETE corechan = open (filename, O_RDONLY, 0); */
74 /* OBSOLETE if (corechan < 0) */
75 /* OBSOLETE perror_with_name (filename); */
76 /* OBSOLETE /* 4.2-style (and perhaps also sysV-style) core dump file. *x/ */
78 /* OBSOLETE struct user u; */
79 /* OBSOLETE int reg_offset; */
81 /* OBSOLETE val = myread (corechan, &u, sizeof u); */
82 /* OBSOLETE if (val < 0) */
83 /* OBSOLETE perror_with_name (filename); */
84 /* OBSOLETE data_start = exec_data_start; */
86 /* OBSOLETE data_end = data_start + NBPG * u.u_dsize; */
87 /* OBSOLETE stack_start = stack_end - NBPG * u.u_ssize; */
88 /* OBSOLETE data_offset = NBPG * UPAGES; */
89 /* OBSOLETE stack_offset = NBPG * (UPAGES + u.u_dsize); */
90 /* OBSOLETE reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR; */
92 /* OBSOLETE /* I don't know where to find this info. */
93 /* OBSOLETE So, for now, mark it as not available. *x/ */
94 /* OBSOLETE core_aouthdr.a_magic = 0; */
96 /* OBSOLETE /* Read the register values out of the core file and store */
97 /* OBSOLETE them where `read_register' will find them. *x/ */
100 /* OBSOLETE register int regno; */
102 /* OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) */
104 /* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */
106 /* OBSOLETE val = lseek (corechan, register_addr (regno, reg_offset), 0); */
107 /* OBSOLETE if (val < 0) */
108 /* OBSOLETE perror_with_name (filename); */
110 /* OBSOLETE val = myread (corechan, buf, sizeof buf); */
111 /* OBSOLETE if (val < 0) */
112 /* OBSOLETE perror_with_name (filename); */
113 /* OBSOLETE supply_register (regno, buf); */
117 /* OBSOLETE if (filename[0] == '/') */
118 /* OBSOLETE corefile = savestring (filename, strlen (filename)); */
121 /* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */
124 /* OBSOLETE flush_cached_frames (); */
125 /* OBSOLETE select_frame (get_current_frame (), 0); */
126 /* OBSOLETE validate_files (); */
128 /* OBSOLETE else if (from_tty) */
129 /* OBSOLETE printf ("No core file now.\n"); */
This page took 0.032526 seconds and 4 git commands to generate.