4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 /*
29 * Immediate Value Target
30 *
31 * The immediate value target is used when the '=' verb is used to
32 * format an immediate value, or with ::print -i. The target is
33 * initialized with a specific value, and then simply copies bytes from
34 * this integer in its read routine. Two notes:
35 *
36 * (1) the address parameter of value_read is treated as an offset into
37 * the immediate value.
38 *
39 * (2) on big-endian systems, we need to be careful about the place we
40 * copy data from. If the caller specified a typesize in the argv array
41 * we use that for offsetting, otherwise we use the read size.
42 * If the user didn't specify the typesize, then 'addr' is ignored,
43 * and all reads are at an offset of 0 into the immediate value. This
44 * covers both the usage of ::print -i, and the semantics of adb
45 * commands like "0x1234=X", which should produce 0x1234 as a result;
46 * the adb model is for it to act like a cast down to the smaller
47 * integer type; this is handled as mentioned.
125 (ssize_t (*)()) mdb_tgt_notsup, /* t_pread */
126 (ssize_t (*)()) mdb_tgt_notsup, /* t_pwrite */
127 value_read, /* t_fread */
128 value_write, /* t_fwrite */
129 value_read, /* t_ioread */
130 value_write, /* t_iowrite */
131 (int (*)()) mdb_tgt_notsup, /* t_vtop */
132 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_name */
133 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_addr */
134 (int (*)()) mdb_tgt_notsup, /* t_symbol_iter */
135 (int (*)()) mdb_tgt_notsup, /* t_mapping_iter */
136 (int (*)()) mdb_tgt_notsup, /* t_object_iter */
137 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_addr_to_map */
138 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_name_to_map */
139 (struct ctf_file *(*)()) mdb_tgt_null, /* t_addr_to_ctf */
140 (struct ctf_file *(*)()) mdb_tgt_null, /* t_name_to_ctf */
141 (int (*)()) mdb_tgt_notsup, /* t_status */
142 (int (*)()) mdb_tgt_notsup, /* t_run */
143 (int (*)()) mdb_tgt_notsup, /* t_step */
144 (int (*)()) mdb_tgt_notsup, /* t_step_out */
145 (int (*)()) mdb_tgt_notsup, /* t_step_branch */
146 (int (*)()) mdb_tgt_notsup, /* t_next */
147 (int (*)()) mdb_tgt_notsup, /* t_cont */
148 (int (*)()) mdb_tgt_notsup, /* t_signal */
149 (int (*)()) mdb_tgt_null, /* t_add_vbrkpt */
150 (int (*)()) mdb_tgt_null, /* t_add_sbrkpt */
151 (int (*)()) mdb_tgt_null, /* t_add_pwapt */
152 (int (*)()) mdb_tgt_null, /* t_add_vwapt */
153 (int (*)()) mdb_tgt_null, /* t_add_iowapt */
154 (int (*)()) mdb_tgt_null, /* t_add_sysenter */
155 (int (*)()) mdb_tgt_null, /* t_add_sysexit */
156 (int (*)()) mdb_tgt_null, /* t_add_signal */
157 (int (*)()) mdb_tgt_null, /* t_add_fault */
158 (int (*)()) mdb_tgt_notsup, /* t_getareg */
159 (int (*)()) mdb_tgt_notsup, /* t_putareg */
160 (int (*)()) mdb_tgt_nop, /* t_stack_iter */
161 (int (*)()) mdb_tgt_notsup /* t_auxv */
162 };
163
164 int
165 mdb_value_tgt_create(mdb_tgt_t *t, int argc, const char *argv[])
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2018 Joyent, Inc.
26 */
27
28 /*
29 * Immediate Value Target
30 *
31 * The immediate value target is used when the '=' verb is used to
32 * format an immediate value, or with ::print -i. The target is
33 * initialized with a specific value, and then simply copies bytes from
34 * this integer in its read routine. Two notes:
35 *
36 * (1) the address parameter of value_read is treated as an offset into
37 * the immediate value.
38 *
39 * (2) on big-endian systems, we need to be careful about the place we
40 * copy data from. If the caller specified a typesize in the argv array
41 * we use that for offsetting, otherwise we use the read size.
42 * If the user didn't specify the typesize, then 'addr' is ignored,
43 * and all reads are at an offset of 0 into the immediate value. This
44 * covers both the usage of ::print -i, and the semantics of adb
45 * commands like "0x1234=X", which should produce 0x1234 as a result;
46 * the adb model is for it to act like a cast down to the smaller
47 * integer type; this is handled as mentioned.
125 (ssize_t (*)()) mdb_tgt_notsup, /* t_pread */
126 (ssize_t (*)()) mdb_tgt_notsup, /* t_pwrite */
127 value_read, /* t_fread */
128 value_write, /* t_fwrite */
129 value_read, /* t_ioread */
130 value_write, /* t_iowrite */
131 (int (*)()) mdb_tgt_notsup, /* t_vtop */
132 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_name */
133 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_addr */
134 (int (*)()) mdb_tgt_notsup, /* t_symbol_iter */
135 (int (*)()) mdb_tgt_notsup, /* t_mapping_iter */
136 (int (*)()) mdb_tgt_notsup, /* t_object_iter */
137 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_addr_to_map */
138 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_name_to_map */
139 (struct ctf_file *(*)()) mdb_tgt_null, /* t_addr_to_ctf */
140 (struct ctf_file *(*)()) mdb_tgt_null, /* t_name_to_ctf */
141 (int (*)()) mdb_tgt_notsup, /* t_status */
142 (int (*)()) mdb_tgt_notsup, /* t_run */
143 (int (*)()) mdb_tgt_notsup, /* t_step */
144 (int (*)()) mdb_tgt_notsup, /* t_step_out */
145 (int (*)()) mdb_tgt_notsup, /* t_next */
146 (int (*)()) mdb_tgt_notsup, /* t_cont */
147 (int (*)()) mdb_tgt_notsup, /* t_signal */
148 (int (*)()) mdb_tgt_null, /* t_add_vbrkpt */
149 (int (*)()) mdb_tgt_null, /* t_add_sbrkpt */
150 (int (*)()) mdb_tgt_null, /* t_add_pwapt */
151 (int (*)()) mdb_tgt_null, /* t_add_vwapt */
152 (int (*)()) mdb_tgt_null, /* t_add_iowapt */
153 (int (*)()) mdb_tgt_null, /* t_add_sysenter */
154 (int (*)()) mdb_tgt_null, /* t_add_sysexit */
155 (int (*)()) mdb_tgt_null, /* t_add_signal */
156 (int (*)()) mdb_tgt_null, /* t_add_fault */
157 (int (*)()) mdb_tgt_notsup, /* t_getareg */
158 (int (*)()) mdb_tgt_notsup, /* t_putareg */
159 (int (*)()) mdb_tgt_nop, /* t_stack_iter */
160 (int (*)()) mdb_tgt_notsup /* t_auxv */
161 };
162
163 int
164 mdb_value_tgt_create(mdb_tgt_t *t, int argc, const char *argv[])
|