OSDN Git Service

* gdbint.texinfo (RETURN_VALUE_ON_STACK): Document.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / gould-xdep.c
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. */
3 /* OBSOLETE  */
4 /* OBSOLETE This file is part of GDB. */
5 /* OBSOLETE  */
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. */
10 /* OBSOLETE  */
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. */
15 /* OBSOLETE  */
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/ */
19 /* OBSOLETE  */
20 /* OBSOLETE #include "defs.h" */
21 /* OBSOLETE #include "frame.h" */
22 /* OBSOLETE #include "inferior.h" */
23 /* OBSOLETE  */
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> */
30 /* OBSOLETE  */
31 /* OBSOLETE #include "gdbcore.h" */
32 /* OBSOLETE  */
33 /* OBSOLETE #include <sys/file.h> */
34 /* OBSOLETE #include "gdb_stat.h" */
35 /* OBSOLETE  */
36 /* OBSOLETE \f */
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/ */
39 /* OBSOLETE  */
40 /* OBSOLETE void */
41 /* OBSOLETE core_file_command (filename, from_tty) */
42 /* OBSOLETE      char *filename; */
43 /* OBSOLETE      int from_tty; */
44 /* OBSOLETE { */
45 /* OBSOLETE   int val; */
46 /* OBSOLETE   extern char registers[]; */
47 /* OBSOLETE  */
48 /* OBSOLETE   /* Discard all vestiges of any previous core file */
49 /* OBSOLETE      and mark data and stack spaces as empty.  *x/ */
50 /* OBSOLETE  */
51 /* OBSOLETE   if (corefile) */
52 /* OBSOLETE     free (corefile); */
53 /* OBSOLETE   corefile = 0; */
54 /* OBSOLETE  */
55 /* OBSOLETE   if (corechan >= 0) */
56 /* OBSOLETE     close (corechan); */
57 /* OBSOLETE   corechan = -1; */
58 /* OBSOLETE  */
59 /* OBSOLETE   data_start = 0; */
60 /* OBSOLETE   data_end = 0; */
61 /* OBSOLETE   stack_start = STACK_END_ADDR; */
62 /* OBSOLETE   stack_end = STACK_END_ADDR; */
63 /* OBSOLETE  */
64 /* OBSOLETE   /* Now, if a new core file was specified, open it and digest it.  *x/ */
65 /* OBSOLETE  */
66 /* OBSOLETE   if (filename) */
67 /* OBSOLETE     { */
68 /* OBSOLETE       filename = tilde_expand (filename); */
69 /* OBSOLETE       make_cleanup (free, filename); */
70 /* OBSOLETE        */
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/ */
77 /* OBSOLETE       { */
78 /* OBSOLETE     struct user u; */
79 /* OBSOLETE     int reg_offset; */
80 /* OBSOLETE  */
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; */
85 /* OBSOLETE  */
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; */
91 /* OBSOLETE  */
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; */
95 /* OBSOLETE  */
96 /* OBSOLETE     /* Read the register values out of the core file and store */
97 /* OBSOLETE        them where `read_register' will find them.  *x/ */
98 /* OBSOLETE  */
99 /* OBSOLETE     { */
100 /* OBSOLETE       register int regno; */
101 /* OBSOLETE  */
102 /* OBSOLETE       for (regno = 0; regno < NUM_REGS; regno++) */
103 /* OBSOLETE         { */
104 /* OBSOLETE           char buf[MAX_REGISTER_RAW_SIZE]; */
105 /* OBSOLETE  */
106 /* OBSOLETE           val = lseek (corechan, register_addr (regno, reg_offset), 0); */
107 /* OBSOLETE           if (val < 0) */
108 /* OBSOLETE             perror_with_name (filename); */
109 /* OBSOLETE  */
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); */
114 /* OBSOLETE         } */
115 /* OBSOLETE     } */
116 /* OBSOLETE       } */
117 /* OBSOLETE       if (filename[0] == '/') */
118 /* OBSOLETE     corefile = savestring (filename, strlen (filename)); */
119 /* OBSOLETE       else */
120 /* OBSOLETE     { */
121 /* OBSOLETE       corefile = concat (current_directory, "/", filename, NULL); */
122 /* OBSOLETE     } */
123 /* OBSOLETE  */
124 /* OBSOLETE       flush_cached_frames (); */
125 /* OBSOLETE       select_frame (get_current_frame (), 0); */
126 /* OBSOLETE       validate_files (); */
127 /* OBSOLETE     } */
128 /* OBSOLETE   else if (from_tty) */
129 /* OBSOLETE     printf ("No core file now.\n"); */
130 /* OBSOLETE } */