Print this page
XXX AVX procfs
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mdb/common/mdb/mdb_proc.h
+++ new/usr/src/cmd/mdb/common/mdb/mdb_proc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #ifndef _MDB_PROC_H
28 28 #define _MDB_PROC_H
29 29
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 30 #include <mdb/mdb_target_impl.h>
33 31 #include <mdb/mdb_io_impl.h>
34 32 #include <mdb/mdb_addrvec.h>
35 33 #include <mdb/mdb_modapi.h>
36 34 #include <mdb/mdb_gelf.h>
37 35 #include <mdb/mdb_tdb.h>
38 36
39 37 #include <sys/param.h>
40 38 #include <libproc.h>
41 39
42 40 #ifdef __cplusplus
43 41 extern "C" {
44 42 #endif
45 43
46 44 #ifdef _MDB
47 45
48 46 /*
49 47 * The proc target must provide support for examining multi-threaded processes
50 48 * that use the raw LWP interface, as well as those that use either of the
51 49 * existing libthread.so implementations. We must also support multiple active
52 50 * instances of the proc target, as well as the notion that a clean process
53 51 * can dlopen() libthread after startup, at which point we need to switch to
54 52 * using libthread_db interfaces to properly debug it. To satisfy these
55 53 * constraints, we declare an ops vector of functions for obtaining the
56 54 * register sets of each thread. The proc target will define two versions
57 55 * of this vector, one for the LWP mode and one for the libthread_db mode,
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
58 56 * and then switch the ops vector pointer as appropriate during debugging.
59 57 * The macros defined below expand to calls to the appropriate entry point.
60 58 */
61 59 typedef struct pt_ptl_ops {
62 60 int (*ptl_ctor)(mdb_tgt_t *);
63 61 void (*ptl_dtor)(mdb_tgt_t *, void *);
64 62 mdb_tgt_tid_t (*ptl_tid)(mdb_tgt_t *, void *);
65 63 int (*ptl_iter)(mdb_tgt_t *, void *, mdb_addrvec_t *);
66 64 int (*ptl_getregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t, prgregset_t);
67 65 int (*ptl_setregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t, prgregset_t);
68 -#ifdef __sparc
69 66 int (*ptl_getxregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t,
70 67 prxregset_t *);
71 68 int (*ptl_setxregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t,
72 69 const prxregset_t *);
73 -#endif
74 70 int (*ptl_getfpregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t,
75 71 prfpregset_t *);
76 72 int (*ptl_setfpregs)(mdb_tgt_t *, void *, mdb_tgt_tid_t,
77 73 const prfpregset_t *);
78 74 } pt_ptl_ops_t;
79 75
80 76 #define PTL_CTOR(t) \
81 77 (((pt_data_t *)(t)->t_data)->p_ptl_ops->ptl_ctor(t))
82 78
83 79 #define PTL_DTOR(t) \
84 80 (((pt_data_t *)(t)->t_data)->p_ptl_ops->ptl_dtor((t), \
85 81 ((pt_data_t *)((t)->t_data))->p_ptl_hdl))
86 82
87 83 #define PTL_TID(t) \
88 84 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_tid((t), \
89 85 ((pt_data_t *)(t)->t_data)->p_ptl_hdl))
90 86
91 87 #define PTL_ITER(t, ap) \
92 88 (((pt_data_t *)(t)->t_data)->p_ptl_ops->ptl_iter((t), \
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
93 89 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (ap)))
94 90
95 91 #define PTL_GETREGS(t, tid, gregs) \
96 92 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_getregs((t), \
97 93 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (gregs)))
98 94
99 95 #define PTL_SETREGS(t, tid, gregs) \
100 96 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_setregs((t), \
101 97 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (gregs)))
102 98
103 -#ifdef __sparc
104 -
105 99 #define PTL_GETXREGS(t, tid, xregs) \
106 100 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_getxregs((t), \
107 101 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (xregs)))
108 102
109 103 #define PTL_SETXREGS(t, tid, xregs) \
110 104 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_setxregs((t), \
111 105 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (xregs)))
112 106
113 -#endif /* __sparc */
114 -
115 107 #define PTL_GETFPREGS(t, tid, fpregs) \
116 108 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_getfpregs((t), \
117 109 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (fpregs)))
118 110
119 111 #define PTL_SETFPREGS(t, tid, fpregs) \
120 112 (((pt_data_t *)((t)->t_data))->p_ptl_ops->ptl_setfpregs((t), \
121 113 ((pt_data_t *)((t)->t_data))->p_ptl_hdl, (tid), (fpregs)))
122 114
123 115 /*
124 116 * When we are following children and a vfork(2) occurs, we append the libproc
125 117 * handle for the parent to a list of vfork parents. We need to keep track of
126 118 * this handle so that when the child subsequently execs or dies, we clear out
127 119 * our breakpoints before releasing the parent.
128 120 */
129 121 typedef struct pt_vforkp {
130 122 mdb_list_t p_list; /* List forward/back pointers */
131 123 struct ps_prochandle *p_pshandle; /* libproc handle */
132 124 } pt_vforkp_t;
133 125
134 126 /*
135 127 * Private data structure for the proc target. Among other things, we keep
136 128 * pointers to the various symbol tables and the ELF file for the executable
137 129 * here, along with handles for our ops vector defined above.
138 130 */
139 131 typedef struct pt_data {
140 132 struct ps_prochandle *p_idlehandle; /* idle libproc handle */
141 133 mdb_gelf_symtab_t *p_symtab; /* Standard symbol table */
142 134 mdb_gelf_symtab_t *p_dynsym; /* Dynamic symbol table */
143 135 mdb_gelf_file_t *p_file; /* ELF file object */
144 136 mdb_io_t *p_fio; /* Current file i/o backend */
145 137 mdb_io_t *p_aout_fio; /* Original file i/o backend */
146 138 char p_platform[MAXNAMELEN]; /* Platform string */
147 139 char p_symname[MDB_TGT_SYM_NAMLEN]; /* Temporary buffer for syms */
148 140 char p_objname[MDB_TGT_MAPSZ]; /* Temporary buffer for objs */
149 141 mdb_map_t p_map; /* Persistent map for callers */
150 142 mdb_list_t p_vforkp; /* List of vfork parents */
151 143 mdb_nv_t p_regs; /* Register descriptions */
152 144 const mdb_tdb_ops_t *p_tdb_ops; /* libthread_db ops */
153 145 const pt_ptl_ops_t *p_ptl_ops; /* Proc thread layer ops */
154 146 void *p_ptl_hdl; /* Proc thread layer handle */
155 147 rd_agent_t *p_rtld; /* librtld_db agent handle */
156 148 const char *p_stdin; /* File for stdin redirect */
157 149 const char *p_stdout; /* File for stdout redirect */
158 150 int p_oflags; /* Flags for open(2) */
159 151 int p_gflags; /* Flags for Pgrab() */
160 152 int p_rflags; /* Flags for Prelease() */
161 153 int p_signal; /* Signal to post at next run */
162 154 int p_rtld_finished; /* Has rtld init completed? */
163 155 int p_rdstate; /* Dlopen state (see below) */
164 156 int p_maxsig; /* Maximum valid signal */
165 157 mdb_nv_t p_env; /* Current environment */
166 158 } pt_data_t;
167 159
168 160 #define PT_RD_NONE 0 /* No update pending */
169 161 #define PT_RD_ADD 1 /* Dlopen detected */
170 162 #define PT_RD_CONSIST 2 /* Link maps consistent */
171 163
172 164 /*
173 165 * The mdb_tgt_gregset type is opaque to callers of the target interface.
174 166 * Inside the target we define it explicitly to be a prgregset_t.
175 167 */
176 168 struct mdb_tgt_gregset {
177 169 prgregset_t gregs;
178 170 };
179 171
180 172 typedef struct pt_symarg {
181 173 mdb_tgt_t *psym_targ; /* Target pointer */
182 174 uint_t psym_which; /* Type of symbol table */
183 175 uint_t psym_type; /* Type of symbols to match */
184 176 mdb_tgt_sym_f *psym_func; /* Callback function */
185 177 void *psym_private; /* Callback data */
186 178 mdb_syminfo_t psym_info; /* Symbol id and table id */
187 179 const char *psym_obj; /* Containing object */
188 180 } pt_symarg_t;
189 181
190 182 typedef struct pt_maparg {
191 183 mdb_tgt_t *pmap_targ; /* Target pointer */
192 184 mdb_tgt_map_f *pmap_func; /* Callback function */
193 185 void *pmap_private; /* Callback data */
194 186 } pt_maparg_t;
195 187
196 188 typedef struct pt_stkarg {
197 189 mdb_tgt_stack_f *pstk_func; /* Callback function */
198 190 void *pstk_private; /* Callback data */
199 191 uint_t pstk_gotpc; /* Non-zero pc found */
200 192 } pt_stkarg_t;
201 193
202 194 typedef struct pt_addarg_t {
203 195 pt_data_t *pa_pt; /* Proc target data */
204 196 mdb_addrvec_t *pa_ap; /* Addrvec pointer */
205 197 } pt_addarg_t;
206 198
207 199 typedef struct pt_brkpt {
208 200 uintptr_t ptb_addr; /* Breakpoint address */
209 201 ulong_t ptb_instr; /* Saved instruction */
210 202 } pt_brkpt_t;
211 203
212 204 typedef struct pt_bparg {
213 205 char *pta_symbol; /* Symbolic name */
214 206 uintptr_t pta_addr; /* Explicit address */
215 207 } pt_bparg_t;
216 208
217 209 /*
218 210 * The proc_isadep.c file is expected to define the following
219 211 * ISA-dependent pieces of the proc target:
220 212 */
221 213 extern int pt_regs(uintptr_t, uint_t, int, const mdb_arg_t *);
222 214 extern int pt_fpregs(uintptr_t, uint_t, int, const mdb_arg_t *);
223 215 extern int pt_step_out(mdb_tgt_t *, uintptr_t *);
224 216 extern int pt_next(mdb_tgt_t *, uintptr_t *);
225 217 extern int pt_getfpreg(mdb_tgt_t *, mdb_tgt_tid_t, ushort_t, ushort_t,
226 218 mdb_tgt_reg_t *);
227 219 extern int pt_putfpreg(mdb_tgt_t *, mdb_tgt_tid_t, ushort_t, ushort_t,
228 220 mdb_tgt_reg_t);
229 221 extern void pt_addfpregs(mdb_tgt_t *);
230 222 extern const char *pt_disasm(const GElf_Ehdr *);
231 223 extern int pt_frameregs(void *, uintptr_t, uint_t, const long *,
232 224 const mdb_tgt_gregset_t *, boolean_t);
233 225 extern const mdb_tgt_regdesc_t pt_regdesc[];
234 226
235 227 #endif /* _MDB */
236 228
237 229 #ifdef __cplusplus
238 230 }
239 231 #endif
240 232
241 233 #endif /* _MDB_PROC_H */
↓ open down ↓ |
117 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX