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 /*
27 * Copyright 2017 Joyent, Inc.
28 */
29
30 /*
31 * Support for ::set dcmd. The +/-o option processing code is provided in a
32 * stand-alone function so it can be used by the command-line option processing
33 * code in mdb_main.c. This facility provides an easy way for us to add more
34 * configurable options without having to add a new dcmd each time.
35 */
36
37 #include <mdb/mdb_target.h>
38 #include <mdb/mdb_modapi.h>
39 #include <mdb/mdb_string.h>
40 #include <mdb/mdb_debug.h>
41 #include <mdb/mdb.h>
42
43 /*ARGSUSED*/
44 static int
45 opt_set_mflags(int enable, uint_t bits, const char *arg)
46 {
47 mdb.m_flags = (mdb.m_flags & ~bits) | (bits & -enable);
258 else
259 mdb_printf("none\n");
260
261 mdb_printf(" array string print limit: ");
262 if (mdb.m_arstrlim != MDB_ARR_NOLIMIT)
263 mdb_printf("%u\n", mdb.m_arstrlim);
264 else
265 mdb_printf("none\n");
266
267 mdb_printf("%*s \"%s\"\n", LABEL_INDENT, "command prompt:",
268 mdb.m_prompt);
269
270 mdb_printf("%*s ", LABEL_INDENT, "debugger options:");
271 (void) mdb_inc_indent(LABEL_INDENT + 1);
272
273 /*
274 * The ::set output implicitly relies on "autowrap" being enabled, so
275 * we enable it for the duration of the command.
276 */
277 oflags = mdb.m_flags;
278 mdb.m_flags |= MDB_FL_AUTOWRAP;
279
280 mdb_printf("follow_exec_mode=");
281 switch (mdb.m_execmode) {
282 case MDB_EM_ASK:
283 mdb_printf("ask");
284 break;
285 case MDB_EM_STOP:
286 mdb_printf("stop");
287 break;
288 case MDB_EM_FOLLOW:
289 mdb_printf("follow");
290 break;
291 }
292
293 #define COMMAFLAG(name) { mdb_printf(", "); mdb_printf(name); }
294
295 COMMAFLAG("follow_fork_mode");
296 switch (mdb.m_forkmode) {
297 case MDB_FM_ASK:
298 mdb_printf("ask");
|
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 /*
27 * Copyright 2020 Joyent, Inc.
28 */
29
30 /*
31 * Support for ::set dcmd. The +/-o option processing code is provided in a
32 * stand-alone function so it can be used by the command-line option processing
33 * code in mdb_main.c. This facility provides an easy way for us to add more
34 * configurable options without having to add a new dcmd each time.
35 */
36
37 #include <mdb/mdb_target.h>
38 #include <mdb/mdb_modapi.h>
39 #include <mdb/mdb_string.h>
40 #include <mdb/mdb_debug.h>
41 #include <mdb/mdb.h>
42
43 /*ARGSUSED*/
44 static int
45 opt_set_mflags(int enable, uint_t bits, const char *arg)
46 {
47 mdb.m_flags = (mdb.m_flags & ~bits) | (bits & -enable);
258 else
259 mdb_printf("none\n");
260
261 mdb_printf(" array string print limit: ");
262 if (mdb.m_arstrlim != MDB_ARR_NOLIMIT)
263 mdb_printf("%u\n", mdb.m_arstrlim);
264 else
265 mdb_printf("none\n");
266
267 mdb_printf("%*s \"%s\"\n", LABEL_INDENT, "command prompt:",
268 mdb.m_prompt);
269
270 mdb_printf("%*s ", LABEL_INDENT, "debugger options:");
271 (void) mdb_inc_indent(LABEL_INDENT + 1);
272
273 /*
274 * The ::set output implicitly relies on "autowrap" being enabled, so
275 * we enable it for the duration of the command.
276 */
277 oflags = mdb.m_flags;
278 mdb_iob_set_autowrap(mdb.m_out);
279
280 mdb_printf("follow_exec_mode=");
281 switch (mdb.m_execmode) {
282 case MDB_EM_ASK:
283 mdb_printf("ask");
284 break;
285 case MDB_EM_STOP:
286 mdb_printf("stop");
287 break;
288 case MDB_EM_FOLLOW:
289 mdb_printf("follow");
290 break;
291 }
292
293 #define COMMAFLAG(name) { mdb_printf(", "); mdb_printf(name); }
294
295 COMMAFLAG("follow_fork_mode");
296 switch (mdb.m_forkmode) {
297 case MDB_FM_ASK:
298 mdb_printf("ask");
|