OLD | NEW |
1 /* <proc_service.h> replacement for systems that don't have it. | 1 /* <proc_service.h> replacement for systems that don't have it. |
2 Copyright (C) 2000, 2007-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2000, 2007-2012 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GDB. | 4 This file is part of GDB. |
5 | 5 |
6 This program is free software; you can redistribute it and/or modify | 6 This program is free software; you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation; either version 3 of the License, or | 8 the Free Software Foundation; either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
11 This program is distributed in the hope that it will be useful, | 11 This program is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
18 | 18 |
19 #ifndef GDB_PROC_SERVICE_H | 19 #ifndef GDB_PROC_SERVICE_H |
20 #define GDB_PROC_SERVICE_H | 20 #define GDB_PROC_SERVICE_H |
21 | 21 |
22 #include <sys/types.h> | 22 #include <sys/types.h> |
23 | 23 |
24 #ifdef HAVE_PROC_SERVICE_H | 24 #ifdef HAVE_PROC_SERVICE_H |
25 #include <proc_service.h> | 25 #include <proc_service.h> |
26 #else | 26 |
| 27 #else /* HAVE_PROC_SERVICE_H */ |
| 28 |
| 29 /* The following fallback definitions have been imported and adjusted |
| 30 from glibc's proc_service.h */ |
| 31 |
| 32 /* Callback interface for libthread_db, functions users must define. |
| 33 Copyright (C) 1999,2002,2003 Free Software Foundation, Inc. |
| 34 This file is part of the GNU C Library. |
| 35 |
| 36 The GNU C Library is free software; you can redistribute it and/or |
| 37 modify it under the terms of the GNU Lesser General Public |
| 38 License as published by the Free Software Foundation; either |
| 39 version 2.1 of the License, or (at your option) any later version. |
| 40 |
| 41 The GNU C Library is distributed in the hope that it will be useful, |
| 42 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 44 Lesser General Public License for more details. |
| 45 |
| 46 You should have received a copy of the GNU Lesser General Public |
| 47 License along with the GNU C Library; if not, see |
| 48 <http://www.gnu.org/licenses/>. */ |
| 49 |
| 50 /* The definitions in this file must correspond to those in the debugger. */ |
27 | 51 |
28 #ifdef HAVE_SYS_PROCFS_H | 52 #ifdef HAVE_SYS_PROCFS_H |
29 #include <sys/procfs.h> | 53 #include <sys/procfs.h> |
30 #endif | 54 #endif |
31 | 55 |
32 #include "gregset.h" | 56 #include "gregset.h" |
33 | 57 |
| 58 /* Functions in this interface return one of these status codes. */ |
34 typedef enum | 59 typedef enum |
35 { | 60 { |
36 PS_OK,» » » /* Success. */ | 61 PS_OK,» » /* Generic "call succeeded". */ |
37 PS_ERR,» » » /* Generic error. */ | 62 PS_ERR,» » /* Generic error. */ |
38 PS_BADPID,» » » /* Bad process handle. */ | 63 PS_BADPID,» » /* Bad process handle. */ |
39 PS_BADLID,» » » /* Bad LWP id. */ | 64 PS_BADLID,» » /* Bad LWP identifier. */ |
40 PS_BADADDR,» » » /* Bad address. */ | 65 PS_BADADDR,» » /* Bad address. */ |
41 PS_NOSYM,» » » /* Symbol not found. */ | 66 PS_NOSYM,» » /* Could not find given symbol. */ |
42 PS_NOFREGS» » » /* FPU register set not available. */ | 67 PS_NOFREGS» » /* FPU register set not available for given LWP. */ |
43 } ps_err_e; | 68 } ps_err_e; |
44 | 69 |
45 #ifndef HAVE_LWPID_T | 70 #ifndef HAVE_LWPID_T |
46 typedef unsigned int lwpid_t; | 71 typedef unsigned int lwpid_t; |
47 #endif | 72 #endif |
48 | 73 |
49 #ifndef HAVE_PSADDR_T | 74 #ifndef HAVE_PSADDR_T |
50 typedef void *psaddr_t; | 75 typedef void *psaddr_t; |
51 #endif | 76 #endif |
52 | 77 |
53 #ifndef HAVE_PRGREGSET_T | 78 #ifndef HAVE_PRGREGSET_T |
54 typedef gdb_gregset_t prgregset_t; | 79 typedef gdb_gregset_t prgregset_t; |
55 #endif | 80 #endif |
56 | 81 |
57 #ifndef HAVE_PRFPREGSET_T | 82 #ifndef HAVE_PRFPREGSET_T |
58 typedef gdb_fpregset_t prfpregset_t; | 83 typedef gdb_fpregset_t prfpregset_t; |
59 #endif | 84 #endif |
60 | 85 |
| 86 /* This type is opaque in this interface. It's defined by the user of |
| 87 libthread_db. GDB's version is defined below. */ |
| 88 struct ps_prochandle; |
| 89 |
| 90 |
| 91 /* Read or write process memory at the given address. */ |
| 92 extern ps_err_e ps_pdread (struct ps_prochandle *, |
| 93 psaddr_t, void *, size_t); |
| 94 extern ps_err_e ps_pdwrite (struct ps_prochandle *, |
| 95 psaddr_t, const void *, size_t); |
| 96 extern ps_err_e ps_ptread (struct ps_prochandle *, |
| 97 psaddr_t, void *, size_t); |
| 98 extern ps_err_e ps_ptwrite (struct ps_prochandle *, |
| 99 psaddr_t, const void *, size_t); |
| 100 |
| 101 |
| 102 /* Get and set the given LWP's general or FPU register set. */ |
| 103 extern ps_err_e ps_lgetregs (struct ps_prochandle *, |
| 104 lwpid_t, prgregset_t); |
| 105 extern ps_err_e ps_lsetregs (struct ps_prochandle *, |
| 106 lwpid_t, const prgregset_t); |
| 107 extern ps_err_e ps_lgetfpregs (struct ps_prochandle *, |
| 108 lwpid_t, prfpregset_t *); |
| 109 extern ps_err_e ps_lsetfpregs (struct ps_prochandle *, |
| 110 lwpid_t, const prfpregset_t *); |
| 111 |
| 112 /* Return the PID of the process. */ |
| 113 extern pid_t ps_getpid (struct ps_prochandle *); |
| 114 |
| 115 /* Fetch the special per-thread address associated with the given LWP. |
| 116 This call is only used on a few platforms (most use a normal register). |
| 117 The meaning of the `int' parameter is machine-dependent. */ |
| 118 extern ps_err_e ps_get_thread_area (const struct ps_prochandle *, |
| 119 lwpid_t, int, psaddr_t *); |
| 120 |
| 121 |
| 122 /* Look up the named symbol in the named DSO in the symbol tables |
| 123 associated with the process being debugged, filling in *SYM_ADDR |
| 124 with the corresponding run-time address. */ |
| 125 extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *, |
| 126 const char *object_name, |
| 127 const char *sym_name, |
| 128 psaddr_t *sym_addr); |
| 129 |
| 130 |
| 131 /* Stop or continue the entire process. */ |
| 132 extern ps_err_e ps_pstop (struct ps_prochandle *); |
| 133 extern ps_err_e ps_pcontinue (struct ps_prochandle *); |
| 134 |
| 135 /* Stop or continue the given LWP alone. */ |
| 136 extern ps_err_e ps_lstop (struct ps_prochandle *, lwpid_t); |
| 137 extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t); |
| 138 |
| 139 /* The following are only defined in/called by Solaris. */ |
| 140 |
| 141 /* Get size of extra register set. */ |
| 142 extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph, |
| 143 lwpid_t lwpid, int *xregsize); |
| 144 /* Get extra register set. */ |
| 145 extern ps_err_e ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid, |
| 146 caddr_t xregset); |
| 147 extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, |
| 148 caddr_t xregset); |
| 149 |
| 150 /* Log a message (sends to gdb_stderr). */ |
| 151 extern void ps_plog (const char *fmt, ...); |
| 152 |
61 #endif /* HAVE_PROC_SERVICE_H */ | 153 #endif /* HAVE_PROC_SERVICE_H */ |
62 | 154 |
63 /* Fix-up some broken systems. */ | 155 /* Fix-up some broken systems. */ |
64 | 156 |
65 /* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t | 157 /* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t |
66 type. We let configure check for this lossage, and make | 158 type. We let configure check for this lossage, and make |
67 appropriate typedefs here. */ | 159 appropriate typedefs here. */ |
68 | 160 |
69 #ifdef PRFPREGSET_T_BROKEN | 161 #ifdef PRFPREGSET_T_BROKEN |
70 typedef gdb_fpregset_t gdb_prfpregset_t; | 162 typedef gdb_fpregset_t gdb_prfpregset_t; |
71 #else | 163 #else |
72 typedef prfpregset_t gdb_prfpregset_t; | 164 typedef prfpregset_t gdb_prfpregset_t; |
73 #endif | 165 #endif |
74 | 166 |
75 /* Structure that identifies the target process. */ | 167 /* GDB specific structure that identifies the target process. */ |
76 struct ps_prochandle | 168 struct ps_prochandle |
77 { | 169 { |
78 /* The LWP we use for memory reads. */ | 170 /* The LWP we use for memory reads. */ |
79 ptid_t ptid; | 171 ptid_t ptid; |
80 }; | 172 }; |
81 | 173 |
82 #endif /* gdb_proc_service.h */ | 174 #endif /* gdb_proc_service.h */ |
OLD | NEW |