1 /* OBSOLETE /* Low level interface to ptrace, for GDB when running under m68k SVR2 Unix */
2 /* OBSOLETE on Altos 3068. Report bugs to Jyrki Kuoppala <jkp@cs.hut.fi> */
3 /* OBSOLETE Copyright (C) 1989, 1991 Free Software Foundation, Inc. */
5 /* OBSOLETE This file is part of GDB. */
7 /* OBSOLETE This program is free software; you can redistribute it and/or modify */
8 /* OBSOLETE it under the terms of the GNU General Public License as published by */
9 /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
10 /* OBSOLETE (at your option) any later version. */
12 /* OBSOLETE This program is distributed in the hope that it will be useful, */
13 /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 /* OBSOLETE GNU General Public License for more details. */
17 /* OBSOLETE You should have received a copy of the GNU General Public License */
18 /* OBSOLETE along with this program; if not, write to the Free Software */
19 /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */
21 /* OBSOLETE #include "defs.h" */
22 /* OBSOLETE #include "frame.h" */
23 /* OBSOLETE #include "inferior.h" */
25 /* OBSOLETE #ifdef USG */
26 /* OBSOLETE #include <sys/types.h> */
29 /* OBSOLETE #include <sys/param.h> */
30 /* OBSOLETE #include <sys/dir.h> */
31 /* OBSOLETE #include <signal.h> */
32 /* OBSOLETE #include <sys/ioctl.h> */
33 /* OBSOLETE #include <fcntl.h> */
34 /* OBSOLETE #ifdef USG */
35 /* OBSOLETE #include <sys/page.h> */
36 /* OBSOLETE #ifdef ALTOS */
37 /* OBSOLETE #include <sys/net.h> */
38 /* OBSOLETE #include <errno.h> */
42 /* OBSOLETE #include "gdbcore.h" */
43 /* OBSOLETE #include <sys/user.h> /* After a.out.h *x/ */
44 /* OBSOLETE #include <sys/file.h> */
45 /* OBSOLETE #include "gdb_stat.h" */
48 /* OBSOLETE /* Work with core dump and executable files, for GDB. */
49 /* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. *x/ */
52 /* OBSOLETE core_file_command (filename, from_tty) */
53 /* OBSOLETE char *filename; */
54 /* OBSOLETE int from_tty; */
56 /* OBSOLETE int val; */
58 /* OBSOLETE /* Discard all vestiges of any previous core file */
59 /* OBSOLETE and mark data and stack spaces as empty. *x/ */
61 /* OBSOLETE if (corefile) */
62 /* OBSOLETE free (corefile); */
63 /* OBSOLETE corefile = 0; */
65 /* OBSOLETE if (corechan >= 0) */
66 /* OBSOLETE close (corechan); */
67 /* OBSOLETE corechan = -1; */
69 /* OBSOLETE data_start = 0; */
70 /* OBSOLETE data_end = 0; */
71 /* OBSOLETE stack_start = STACK_END_ADDR; */
72 /* OBSOLETE stack_end = STACK_END_ADDR; */
74 /* OBSOLETE /* Now, if a new core file was specified, open it and digest it. *x/ */
76 /* OBSOLETE if (filename) */
78 /* OBSOLETE filename = tilde_expand (filename); */
79 /* OBSOLETE make_cleanup (free, filename); */
81 /* OBSOLETE if (have_inferior_p ()) */
82 /* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */
83 /* OBSOLETE corechan = open (filename, O_RDONLY, 0); */
84 /* OBSOLETE if (corechan < 0) */
85 /* OBSOLETE perror_with_name (filename); */
86 /* OBSOLETE /* 4.2-style (and perhaps also sysV-style) core dump file. *x/ */
88 /* OBSOLETE struct user u; */
90 /* OBSOLETE unsigned int reg_offset; */
92 /* OBSOLETE val = myread (corechan, &u, sizeof u); */
93 /* OBSOLETE if (val < 0) */
94 /* OBSOLETE perror_with_name ("Not a core file: reading upage"); */
95 /* OBSOLETE if (val != sizeof u) */
96 /* OBSOLETE error ("Not a core file: could only read %d bytes", val); */
97 /* OBSOLETE data_start = exec_data_start; */
99 /* OBSOLETE #if !defined (NBPG) */
100 /* OBSOLETE #define NBPG NBPP */
101 /* OBSOLETE #endif */
102 /* OBSOLETE #if !defined (UPAGES) */
103 /* OBSOLETE #define UPAGES USIZE */
104 /* OBSOLETE #endif */
106 /* OBSOLETE data_end = data_start + NBPG * u.u_dsize; */
107 /* OBSOLETE stack_start = stack_end - NBPG * u.u_ssize; */
108 /* OBSOLETE data_offset = NBPG * UPAGES + exec_data_start % NBPG /* Not sure about this //jkp *x/; */
109 /* OBSOLETE stack_offset = NBPG * (UPAGES + u.u_dsize); */
111 /* OBSOLETE /* Some machines put an absolute address in here and some put */
112 /* OBSOLETE the offset in the upage of the regs. *x/ */
113 /* OBSOLETE reg_offset = (int) u.u_state; */
114 /* OBSOLETE if (reg_offset > NBPG * UPAGES) */
115 /* OBSOLETE reg_offset -= KERNEL_U_ADDR; */
117 /* OBSOLETE memcpy (&core_aouthdr, &u.u_exdata, sizeof (AOUTHDR)); */
118 /* OBSOLETE printf_unfiltered ("Core file is from \"%s\".\n", u.u_comm); */
120 /* OBSOLETE /* I don't know where to find this info. */
121 /* OBSOLETE So, for now, mark it as not available. *x/ */
122 /* OBSOLETE N_SET_MAGIC (core_aouthdr, 0); */
124 /* OBSOLETE /* Read the register values out of the core file and store */
125 /* OBSOLETE them where `read_register' will find them. *x/ */
128 /* OBSOLETE register int regno; */
130 /* OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) */
132 /* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */
134 /* OBSOLETE val = lseek (corechan, register_addr (regno, reg_offset), 0); */
135 /* OBSOLETE if (val < 0 */
136 /* OBSOLETE || (val = myread (corechan, buf, sizeof buf)) < 0) */
138 /* OBSOLETE char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) */
139 /* OBSOLETE + 30); */
140 /* OBSOLETE strcpy (buffer, "Reading register "); */
141 /* OBSOLETE strcat (buffer, REGISTER_NAME (regno)); */
143 /* OBSOLETE perror_with_name (buffer); */
146 /* OBSOLETE supply_register (regno, buf); */
150 /* OBSOLETE if (filename[0] == '/') */
151 /* OBSOLETE corefile = savestring (filename, strlen (filename)); */
154 /* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */
157 /* OBSOLETE flush_cached_frames (); */
158 /* OBSOLETE select_frame (get_current_frame (), 0); */
159 /* OBSOLETE validate_files (); */
161 /* OBSOLETE else if (from_tty) */
162 /* OBSOLETE printf_unfiltered ("No core file now.\n"); */
This page took 0.031882 seconds and 4 git commands to generate.