1 |
578 |
markom |
/* OBSOLETE /* umax host stuff. */
|
2 |
|
|
/* OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1995, 1999, 2000, 2001 */
|
3 |
|
|
/* OBSOLETE Free Software Foundation, Inc. */
|
4 |
|
|
/* OBSOLETE */
|
5 |
|
|
/* OBSOLETE This file is part of GDB. */
|
6 |
|
|
/* OBSOLETE */
|
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. */
|
11 |
|
|
/* OBSOLETE */
|
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. */
|
16 |
|
|
/* OBSOLETE */
|
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, */
|
20 |
|
|
/* OBSOLETE Boston, MA 02111-1307, USA. */ */
|
21 |
|
|
/* OBSOLETE */
|
22 |
|
|
/* OBSOLETE #include "defs.h" */
|
23 |
|
|
/* OBSOLETE #include "frame.h" */
|
24 |
|
|
/* OBSOLETE #include "inferior.h" */
|
25 |
|
|
/* OBSOLETE #include "regcache.h" */
|
26 |
|
|
/* OBSOLETE */
|
27 |
|
|
/* OBSOLETE #include <sys/param.h> */
|
28 |
|
|
/* OBSOLETE #include <sys/dir.h> */
|
29 |
|
|
/* OBSOLETE #include <signal.h> */
|
30 |
|
|
/* OBSOLETE #include <sys/ioctl.h> */
|
31 |
|
|
/* OBSOLETE #include <fcntl.h> */
|
32 |
|
|
/* OBSOLETE */
|
33 |
|
|
/* OBSOLETE #include "gdbcore.h" */
|
34 |
|
|
/* OBSOLETE #include <sys/ptrace.h> */
|
35 |
|
|
/* OBSOLETE #define PTRACE_ATTACH PT_ATTACH */
|
36 |
|
|
/* OBSOLETE #define PTRACE_DETACH PT_FREEPROC */
|
37 |
|
|
/* OBSOLETE */
|
38 |
|
|
/* OBSOLETE #include <sys/file.h> */
|
39 |
|
|
/* OBSOLETE #include "gdb_stat.h" */
|
40 |
|
|
/* OBSOLETE */
|
41 |
|
|
/* OBSOLETE /* Work with core dump and executable files, for GDB. */
|
42 |
|
|
/* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. */ */
|
43 |
|
|
/* OBSOLETE */
|
44 |
|
|
/* OBSOLETE void */
|
45 |
|
|
/* OBSOLETE core_file_command (char *filename, int from_tty) */
|
46 |
|
|
/* OBSOLETE { */
|
47 |
|
|
/* OBSOLETE int val; */
|
48 |
|
|
/* OBSOLETE */
|
49 |
|
|
/* OBSOLETE /* Discard all vestiges of any previous core file */
|
50 |
|
|
/* OBSOLETE and mark data and stack spaces as empty. */ */
|
51 |
|
|
/* OBSOLETE */
|
52 |
|
|
/* OBSOLETE if (corefile) */
|
53 |
|
|
/* OBSOLETE xfree (corefile); */
|
54 |
|
|
/* OBSOLETE corefile = 0; */
|
55 |
|
|
/* OBSOLETE */
|
56 |
|
|
/* OBSOLETE if (corechan >= 0) */
|
57 |
|
|
/* OBSOLETE close (corechan); */
|
58 |
|
|
/* OBSOLETE corechan = -1; */
|
59 |
|
|
/* OBSOLETE */
|
60 |
|
|
/* OBSOLETE data_start = 0; */
|
61 |
|
|
/* OBSOLETE data_end = 0; */
|
62 |
|
|
/* OBSOLETE stack_start = STACK_END_ADDR; */
|
63 |
|
|
/* OBSOLETE stack_end = STACK_END_ADDR; */
|
64 |
|
|
/* OBSOLETE */
|
65 |
|
|
/* OBSOLETE /* Now, if a new core file was specified, open it and digest it. */ */
|
66 |
|
|
/* OBSOLETE */
|
67 |
|
|
/* OBSOLETE if (filename) */
|
68 |
|
|
/* OBSOLETE { */
|
69 |
|
|
/* OBSOLETE filename = tilde_expand (filename); */
|
70 |
|
|
/* OBSOLETE make_cleanup (xfree, filename); */
|
71 |
|
|
/* OBSOLETE */
|
72 |
|
|
/* OBSOLETE if (have_inferior_p ()) */
|
73 |
|
|
/* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */
|
74 |
|
|
/* OBSOLETE corechan = open (filename, O_RDONLY, 0); */
|
75 |
|
|
/* OBSOLETE if (corechan < 0) */
|
76 |
|
|
/* OBSOLETE perror_with_name (filename); */
|
77 |
|
|
/* OBSOLETE /* 4.2-style (and perhaps also sysV-style) core dump file. */ */
|
78 |
|
|
/* OBSOLETE { */
|
79 |
|
|
/* OBSOLETE struct ptrace_user u; */
|
80 |
|
|
/* OBSOLETE int reg_offset; */
|
81 |
|
|
/* OBSOLETE */
|
82 |
|
|
/* OBSOLETE val = myread (corechan, &u, sizeof u); */
|
83 |
|
|
/* OBSOLETE if (val < 0) */
|
84 |
|
|
/* OBSOLETE perror_with_name (filename); */
|
85 |
|
|
/* OBSOLETE data_start = exec_data_start; */
|
86 |
|
|
/* OBSOLETE */
|
87 |
|
|
/* OBSOLETE data_end = data_start + u.pt_dsize; */
|
88 |
|
|
/* OBSOLETE stack_start = stack_end - u.pt_ssize; */
|
89 |
|
|
/* OBSOLETE data_offset = sizeof u; */
|
90 |
|
|
/* OBSOLETE stack_offset = data_offset + u.pt_dsize; */
|
91 |
|
|
/* OBSOLETE reg_offset = 0; */
|
92 |
|
|
/* OBSOLETE */
|
93 |
|
|
/* OBSOLETE memcpy (&core_aouthdr, &u.pt_aouthdr, sizeof (AOUTHDR)); */
|
94 |
|
|
/* OBSOLETE printf_unfiltered ("Core file is from \"%s\".\n", u.pt_comm); */
|
95 |
|
|
/* OBSOLETE if (u.pt_signal > 0) */
|
96 |
|
|
/* OBSOLETE printf_unfiltered ("Program terminated with signal %d, %s.\n", */
|
97 |
|
|
/* OBSOLETE u.pt_signal, safe_strsignal (u.pt_signal)); */
|
98 |
|
|
/* OBSOLETE */
|
99 |
|
|
/* OBSOLETE /* Read the register values out of the core file and store */
|
100 |
|
|
/* OBSOLETE them where `read_register' will find them. */ */
|
101 |
|
|
/* OBSOLETE */
|
102 |
|
|
/* OBSOLETE { */
|
103 |
|
|
/* OBSOLETE register int regno; */
|
104 |
|
|
/* OBSOLETE */
|
105 |
|
|
/* OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) */
|
106 |
|
|
/* OBSOLETE { */
|
107 |
|
|
/* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */
|
108 |
|
|
/* OBSOLETE */
|
109 |
|
|
/* OBSOLETE val = lseek (corechan, register_addr (regno, reg_offset), 0); */
|
110 |
|
|
/* OBSOLETE if (val < 0) */
|
111 |
|
|
/* OBSOLETE perror_with_name (filename); */
|
112 |
|
|
/* OBSOLETE */
|
113 |
|
|
/* OBSOLETE val = myread (corechan, buf, sizeof buf); */
|
114 |
|
|
/* OBSOLETE if (val < 0) */
|
115 |
|
|
/* OBSOLETE perror_with_name (filename); */
|
116 |
|
|
/* OBSOLETE supply_register (regno, buf); */
|
117 |
|
|
/* OBSOLETE } */
|
118 |
|
|
/* OBSOLETE } */
|
119 |
|
|
/* OBSOLETE } */
|
120 |
|
|
/* OBSOLETE if (filename[0] == '/') */
|
121 |
|
|
/* OBSOLETE corefile = savestring (filename, strlen (filename)); */
|
122 |
|
|
/* OBSOLETE else */
|
123 |
|
|
/* OBSOLETE { */
|
124 |
|
|
/* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */
|
125 |
|
|
/* OBSOLETE } */
|
126 |
|
|
/* OBSOLETE */
|
127 |
|
|
/* OBSOLETE flush_cached_frames (); */
|
128 |
|
|
/* OBSOLETE select_frame (get_current_frame (), 0); */
|
129 |
|
|
/* OBSOLETE validate_files (); */
|
130 |
|
|
/* OBSOLETE } */
|
131 |
|
|
/* OBSOLETE else if (from_tty) */
|
132 |
|
|
/* OBSOLETE printf_unfiltered ("No core file now.\n"); */
|
133 |
|
|
/* OBSOLETE } */
|