xref: /freebsd/sys/ddb/db_run.c (revision 08cfba5d)
1dd3cb568SWarner Losh /*-
25b81b6b3SRodney W. Grimes  * Mach Operating System
35b81b6b3SRodney W. Grimes  * Copyright (c) 1991,1990 Carnegie Mellon University
45b81b6b3SRodney W. Grimes  * All Rights Reserved.
55b81b6b3SRodney W. Grimes  *
65b81b6b3SRodney W. Grimes  * Permission to use, copy, modify and distribute this software and its
75b81b6b3SRodney W. Grimes  * documentation is hereby granted, provided that both the copyright
85b81b6b3SRodney W. Grimes  * notice and this permission notice appear in all copies of the
95b81b6b3SRodney W. Grimes  * software, derivative works or modified versions, and any portions
105b81b6b3SRodney W. Grimes  * thereof, and that both notices appear in supporting documentation.
115b81b6b3SRodney W. Grimes  *
125b81b6b3SRodney W. Grimes  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
135b81b6b3SRodney W. Grimes  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
145b81b6b3SRodney W. Grimes  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
155b81b6b3SRodney W. Grimes  *
165b81b6b3SRodney W. Grimes  * Carnegie Mellon requests users of this software to return to
175b81b6b3SRodney W. Grimes  *
185b81b6b3SRodney W. Grimes  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
195b81b6b3SRodney W. Grimes  *  School of Computer Science
205b81b6b3SRodney W. Grimes  *  Carnegie Mellon University
215b81b6b3SRodney W. Grimes  *  Pittsburgh PA 15213-3890
225b81b6b3SRodney W. Grimes  *
235b81b6b3SRodney W. Grimes  * any improvements or extensions that they make and grant Carnegie the
245b81b6b3SRodney W. Grimes  * rights to redistribute these changes.
255b81b6b3SRodney W. Grimes  */
265b81b6b3SRodney W. Grimes /*
275b81b6b3SRodney W. Grimes  * 	Author: David B. Golub, Carnegie Mellon University
285b81b6b3SRodney W. Grimes  *	Date:	7/90
295b81b6b3SRodney W. Grimes  */
305b81b6b3SRodney W. Grimes 
315b81b6b3SRodney W. Grimes /*
325b81b6b3SRodney W. Grimes  * Commands to run process.
335b81b6b3SRodney W. Grimes  */
34753960f7SDavid E. O'Brien 
35753960f7SDavid E. O'Brien #include <sys/cdefs.h>
36753960f7SDavid E. O'Brien __FBSDID("$FreeBSD$");
37753960f7SDavid E. O'Brien 
38f540b106SGarrett Wollman #include <sys/param.h>
3937224cd3SMarcel Moolenaar #include <sys/kdb.h>
4020984f2fSPeter Wemm #include <sys/proc.h>
4137224cd3SMarcel Moolenaar 
4237224cd3SMarcel Moolenaar #include <machine/kdb.h>
4337224cd3SMarcel Moolenaar #include <machine/pcb.h>
445b81b6b3SRodney W. Grimes 
455ccbc3ccSBruce Evans #include <vm/vm.h>
465ccbc3ccSBruce Evans 
475ccbc3ccSBruce Evans #include <ddb/ddb.h>
485b81b6b3SRodney W. Grimes #include <ddb/db_break.h>
495b81b6b3SRodney W. Grimes #include <ddb/db_access.h>
505b81b6b3SRodney W. Grimes 
5125eb640dSPoul-Henning Kamp static int	db_run_mode;
525b81b6b3SRodney W. Grimes #define	STEP_NONE	0
535b81b6b3SRodney W. Grimes #define	STEP_ONCE	1
545b81b6b3SRodney W. Grimes #define	STEP_RETURN	2
555b81b6b3SRodney W. Grimes #define	STEP_CALLT	3
565b81b6b3SRodney W. Grimes #define	STEP_CONTINUE	4
575b81b6b3SRodney W. Grimes #define STEP_INVISIBLE	5
585b81b6b3SRodney W. Grimes #define	STEP_COUNT	6
595b81b6b3SRodney W. Grimes 
6025eb640dSPoul-Henning Kamp static boolean_t	db_sstep_print;
6125eb640dSPoul-Henning Kamp static int		db_loop_count;
6225eb640dSPoul-Henning Kamp static int		db_call_depth;
635b81b6b3SRodney W. Grimes 
645b81b6b3SRodney W. Grimes int		db_inst_count;
655b81b6b3SRodney W. Grimes int		db_load_count;
665b81b6b3SRodney W. Grimes int		db_store_count;
675b81b6b3SRodney W. Grimes 
685b81b6b3SRodney W. Grimes #ifndef db_set_single_step
6937224cd3SMarcel Moolenaar void db_set_single_step(void);
705b81b6b3SRodney W. Grimes #endif
715b81b6b3SRodney W. Grimes #ifndef db_clear_single_step
7237224cd3SMarcel Moolenaar void db_clear_single_step(void);
73f73a856dSPoul-Henning Kamp #endif
74f73a856dSPoul-Henning Kamp 
7575f88c7cSOlivier Houchard #ifdef SOFTWARE_SSTEP
7675f88c7cSOlivier Houchard db_breakpoint_t	db_not_taken_bkpt = 0;
7775f88c7cSOlivier Houchard db_breakpoint_t	db_taken_bkpt = 0;
7875f88c7cSOlivier Houchard #endif
7975f88c7cSOlivier Houchard 
805b81b6b3SRodney W. Grimes boolean_t
815b81b6b3SRodney W. Grimes db_stop_at_pc(is_breakpoint)
825b81b6b3SRodney W. Grimes 	boolean_t	*is_breakpoint;
835b81b6b3SRodney W. Grimes {
845b81b6b3SRodney W. Grimes 	register db_addr_t	pc;
855b81b6b3SRodney W. Grimes 	register db_breakpoint_t bkpt;
865b81b6b3SRodney W. Grimes 
8775f88c7cSOlivier Houchard 	pc = PC_REGS();
8875f88c7cSOlivier Houchard #ifdef SOFTWARE_SSTEP
8975f88c7cSOlivier Houchard 	if ((db_not_taken_bkpt != 0 && pc == db_not_taken_bkpt->address)
9075f88c7cSOlivier Houchard 	    || (db_taken_bkpt != 0 && pc == db_taken_bkpt->address))
9175f88c7cSOlivier Houchard 		*is_breakpoint = FALSE;
9275f88c7cSOlivier Houchard #endif
9375f88c7cSOlivier Houchard 
9437224cd3SMarcel Moolenaar 	db_clear_single_step();
955b81b6b3SRodney W. Grimes 	db_clear_breakpoints();
965b81b6b3SRodney W. Grimes 	db_clear_watchpoints();
975b81b6b3SRodney W. Grimes 
985b81b6b3SRodney W. Grimes #ifdef	FIXUP_PC_AFTER_BREAK
995b81b6b3SRodney W. Grimes 	if (*is_breakpoint) {
1005b81b6b3SRodney W. Grimes 	    /*
1015b81b6b3SRodney W. Grimes 	     * Breakpoint trap.  Fix up the PC if the
1025b81b6b3SRodney W. Grimes 	     * machine requires it.
1035b81b6b3SRodney W. Grimes 	     */
1045b81b6b3SRodney W. Grimes 	    FIXUP_PC_AFTER_BREAK
10537224cd3SMarcel Moolenaar 	    pc = PC_REGS();
1065b81b6b3SRodney W. Grimes 	}
1075b81b6b3SRodney W. Grimes #endif
1085b81b6b3SRodney W. Grimes 
1095b81b6b3SRodney W. Grimes 	/*
1105b81b6b3SRodney W. Grimes 	 * Now check for a breakpoint at this address.
1115b81b6b3SRodney W. Grimes 	 */
1125b81b6b3SRodney W. Grimes 	bkpt = db_find_breakpoint_here(pc);
1135b81b6b3SRodney W. Grimes 	if (bkpt) {
1145b81b6b3SRodney W. Grimes 	    if (--bkpt->count == 0) {
1155b81b6b3SRodney W. Grimes 		bkpt->count = bkpt->init_count;
1165b81b6b3SRodney W. Grimes 		*is_breakpoint = TRUE;
1175b81b6b3SRodney W. Grimes 		return (TRUE);	/* stop here */
1185b81b6b3SRodney W. Grimes 	    }
1195b81b6b3SRodney W. Grimes 	} else if (*is_breakpoint) {
1203a0b4f25SDoug Rabson #ifdef BKPT_SKIP
1213a0b4f25SDoug Rabson 		BKPT_SKIP;
122ecbb00a2SDoug Rabson #endif
1235b81b6b3SRodney W. Grimes 	}
1245b81b6b3SRodney W. Grimes 
1255b81b6b3SRodney W. Grimes 	*is_breakpoint = FALSE;
1265b81b6b3SRodney W. Grimes 
1275b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_INVISIBLE) {
1285b81b6b3SRodney W. Grimes 	    db_run_mode = STEP_CONTINUE;
1295b81b6b3SRodney W. Grimes 	    return (FALSE);	/* continue */
1305b81b6b3SRodney W. Grimes 	}
1315b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_COUNT) {
1325b81b6b3SRodney W. Grimes 	    return (FALSE); /* continue */
1335b81b6b3SRodney W. Grimes 	}
1345b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_ONCE) {
1355b81b6b3SRodney W. Grimes 	    if (--db_loop_count > 0) {
1365b81b6b3SRodney W. Grimes 		if (db_sstep_print) {
1375b81b6b3SRodney W. Grimes 		    db_printf("\t\t");
1385b81b6b3SRodney W. Grimes 		    db_print_loc_and_inst(pc);
1395b81b6b3SRodney W. Grimes 		    db_printf("\n");
1405b81b6b3SRodney W. Grimes 		}
1415b81b6b3SRodney W. Grimes 		return (FALSE);	/* continue */
1425b81b6b3SRodney W. Grimes 	    }
1435b81b6b3SRodney W. Grimes 	}
1445b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_RETURN) {
1455b81b6b3SRodney W. Grimes 	    /* continue until matching return */
14653b3e912SMaxime Henrion 	    db_expr_t ins;
1475b81b6b3SRodney W. Grimes 
14853b3e912SMaxime Henrion 	    ins = db_get_value(pc, sizeof(int), FALSE);
1495b81b6b3SRodney W. Grimes 	    if (!inst_trap_return(ins) &&
1505b81b6b3SRodney W. Grimes 		(!inst_return(ins) || --db_call_depth != 0)) {
1515b81b6b3SRodney W. Grimes 		if (db_sstep_print) {
1525b81b6b3SRodney W. Grimes 		    if (inst_call(ins) || inst_return(ins)) {
1535b81b6b3SRodney W. Grimes 			register int i;
1545b81b6b3SRodney W. Grimes 
1555b81b6b3SRodney W. Grimes 			db_printf("[after %6d]     ", db_inst_count);
1565b81b6b3SRodney W. Grimes 			for (i = db_call_depth; --i > 0; )
1575b81b6b3SRodney W. Grimes 			    db_printf("  ");
1585b81b6b3SRodney W. Grimes 			db_print_loc_and_inst(pc);
1595b81b6b3SRodney W. Grimes 			db_printf("\n");
1605b81b6b3SRodney W. Grimes 		    }
1615b81b6b3SRodney W. Grimes 		}
1625b81b6b3SRodney W. Grimes 		if (inst_call(ins))
1635b81b6b3SRodney W. Grimes 		    db_call_depth++;
1645b81b6b3SRodney W. Grimes 		return (FALSE);	/* continue */
1655b81b6b3SRodney W. Grimes 	    }
1665b81b6b3SRodney W. Grimes 	}
1675b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_CALLT) {
1685b81b6b3SRodney W. Grimes 	    /* continue until call or return */
16953b3e912SMaxime Henrion 	    db_expr_t ins;
1705b81b6b3SRodney W. Grimes 
17153b3e912SMaxime Henrion 	    ins = db_get_value(pc, sizeof(int), FALSE);
1725b81b6b3SRodney W. Grimes 	    if (!inst_call(ins) &&
1735b81b6b3SRodney W. Grimes 		!inst_return(ins) &&
1745b81b6b3SRodney W. Grimes 		!inst_trap_return(ins)) {
1755b81b6b3SRodney W. Grimes 		return (FALSE);	/* continue */
1765b81b6b3SRodney W. Grimes 	    }
1775b81b6b3SRodney W. Grimes 	}
1785b81b6b3SRodney W. Grimes 	db_run_mode = STEP_NONE;
1795b81b6b3SRodney W. Grimes 	return (TRUE);
1805b81b6b3SRodney W. Grimes }
1815b81b6b3SRodney W. Grimes 
1825b81b6b3SRodney W. Grimes void
1835b81b6b3SRodney W. Grimes db_restart_at_pc(watchpt)
1845b81b6b3SRodney W. Grimes 	boolean_t watchpt;
1855b81b6b3SRodney W. Grimes {
18637224cd3SMarcel Moolenaar 	register db_addr_t	pc = PC_REGS();
1875b81b6b3SRodney W. Grimes 
1885b81b6b3SRodney W. Grimes 	if ((db_run_mode == STEP_COUNT) ||
1895b81b6b3SRodney W. Grimes 	    (db_run_mode == STEP_RETURN) ||
1905b81b6b3SRodney W. Grimes 	    (db_run_mode == STEP_CALLT)) {
1915b81b6b3SRodney W. Grimes 	    db_expr_t		ins;
1925b81b6b3SRodney W. Grimes 
1935b81b6b3SRodney W. Grimes 	    /*
1945b81b6b3SRodney W. Grimes 	     * We are about to execute this instruction,
1955b81b6b3SRodney W. Grimes 	     * so count it now.
1965b81b6b3SRodney W. Grimes 	     */
1975b81b6b3SRodney W. Grimes 
1985b81b6b3SRodney W. Grimes 	    ins = db_get_value(pc, sizeof(int), FALSE);
1995b81b6b3SRodney W. Grimes 	    db_inst_count++;
2005b81b6b3SRodney W. Grimes 	    db_load_count += inst_load(ins);
2015b81b6b3SRodney W. Grimes 	    db_store_count += inst_store(ins);
2025b81b6b3SRodney W. Grimes #ifdef	SOFTWARE_SSTEP
2035b81b6b3SRodney W. Grimes 	    /* XXX works on mips, but... */
2045b81b6b3SRodney W. Grimes 	    if (inst_branch(ins) || inst_call(ins)) {
2055b81b6b3SRodney W. Grimes 		ins = db_get_value(next_instr_address(pc,1),
2065b81b6b3SRodney W. Grimes 				   sizeof(int), FALSE);
2075b81b6b3SRodney W. Grimes 		db_inst_count++;
2085b81b6b3SRodney W. Grimes 		db_load_count += inst_load(ins);
2095b81b6b3SRodney W. Grimes 		db_store_count += inst_store(ins);
2105b81b6b3SRodney W. Grimes 	    }
21168016904SDavid E. O'Brien #endif	/* SOFTWARE_SSTEP */
2125b81b6b3SRodney W. Grimes 	}
2135b81b6b3SRodney W. Grimes 
2145b81b6b3SRodney W. Grimes 	if (db_run_mode == STEP_CONTINUE) {
2155b81b6b3SRodney W. Grimes 	    if (watchpt || db_find_breakpoint_here(pc)) {
2165b81b6b3SRodney W. Grimes 		/*
2175b81b6b3SRodney W. Grimes 		 * Step over breakpoint/watchpoint.
2185b81b6b3SRodney W. Grimes 		 */
2195b81b6b3SRodney W. Grimes 		db_run_mode = STEP_INVISIBLE;
22037224cd3SMarcel Moolenaar 		db_set_single_step();
2215b81b6b3SRodney W. Grimes 	    } else {
2225b81b6b3SRodney W. Grimes 		db_set_breakpoints();
2235b81b6b3SRodney W. Grimes 		db_set_watchpoints();
2245b81b6b3SRodney W. Grimes 	    }
2255b81b6b3SRodney W. Grimes 	} else {
22637224cd3SMarcel Moolenaar 	    db_set_single_step();
2275b81b6b3SRodney W. Grimes 	}
2285b81b6b3SRodney W. Grimes }
2295b81b6b3SRodney W. Grimes 
2305b81b6b3SRodney W. Grimes #ifdef	SOFTWARE_SSTEP
2315b81b6b3SRodney W. Grimes /*
2325b81b6b3SRodney W. Grimes  *	Software implementation of single-stepping.
2335b81b6b3SRodney W. Grimes  *	If your machine does not have a trace mode
2345b81b6b3SRodney W. Grimes  *	similar to the vax or sun ones you can use
2355b81b6b3SRodney W. Grimes  *	this implementation, done for the mips.
2365b81b6b3SRodney W. Grimes  *	Just define the above conditional and provide
2375b81b6b3SRodney W. Grimes  *	the functions/macros defined below.
2385b81b6b3SRodney W. Grimes  *
2395b81b6b3SRodney W. Grimes  * extern boolean_t
2405b81b6b3SRodney W. Grimes  *	inst_branch(),		returns true if the instruction might branch
2415b81b6b3SRodney W. Grimes  * extern unsigned
2425b81b6b3SRodney W. Grimes  *	branch_taken(),		return the address the instruction might
2435b81b6b3SRodney W. Grimes  *				branch to
2445b81b6b3SRodney W. Grimes  *	db_getreg_val();	return the value of a user register,
2455b81b6b3SRodney W. Grimes  *				as indicated in the hardware instruction
2465b81b6b3SRodney W. Grimes  *				encoding, e.g. 8 for r8
2475b81b6b3SRodney W. Grimes  *
2485b81b6b3SRodney W. Grimes  * next_instr_address(pc,bd)	returns the address of the first
2495b81b6b3SRodney W. Grimes  *				instruction following the one at "pc",
2505b81b6b3SRodney W. Grimes  *				which is either in the taken path of
2515b81b6b3SRodney W. Grimes  *				the branch (bd==1) or not.  This is
2525b81b6b3SRodney W. Grimes  *				for machines (mips) with branch delays.
2535b81b6b3SRodney W. Grimes  *
2545b81b6b3SRodney W. Grimes  *	A single-step may involve at most 2 breakpoints -
2555b81b6b3SRodney W. Grimes  *	one for branch-not-taken and one for branch taken.
2565b81b6b3SRodney W. Grimes  *	If one of these addresses does not already have a breakpoint,
2575b81b6b3SRodney W. Grimes  *	we allocate a breakpoint and save it here.
2585b81b6b3SRodney W. Grimes  *	These breakpoints are deleted on return.
2595b81b6b3SRodney W. Grimes  */
2605b81b6b3SRodney W. Grimes 
2615b81b6b3SRodney W. Grimes void
26237224cd3SMarcel Moolenaar db_set_single_step(void)
2635b81b6b3SRodney W. Grimes {
26437224cd3SMarcel Moolenaar 	db_addr_t pc = PC_REGS(), brpc;
2657045d394SDoug Rabson 	unsigned inst;
2665b81b6b3SRodney W. Grimes 
2675b81b6b3SRodney W. Grimes 	/*
2685b81b6b3SRodney W. Grimes 	 *	User was stopped at pc, e.g. the instruction
2695b81b6b3SRodney W. Grimes 	 *	at pc was not executed.
2705b81b6b3SRodney W. Grimes 	 */
2715b81b6b3SRodney W. Grimes 	inst = db_get_value(pc, sizeof(int), FALSE);
27208cfba5dSOlivier Houchard 	if (inst_branch(inst) || inst_call(inst) || inst_return(inst)) {
27337224cd3SMarcel Moolenaar 		brpc = branch_taken(inst, pc);
2745b81b6b3SRodney W. Grimes 		if (brpc != pc) {	/* self-branches are hopeless */
2755b81b6b3SRodney W. Grimes 			db_taken_bkpt = db_set_temp_breakpoint(brpc);
2765b81b6b3SRodney W. Grimes 		}
2775b81b6b3SRodney W. Grimes 		pc = next_instr_address(pc, 1);
2785b81b6b3SRodney W. Grimes 	}
2795b81b6b3SRodney W. Grimes 	pc = next_instr_address(pc, 0);
2805b81b6b3SRodney W. Grimes 	db_not_taken_bkpt = db_set_temp_breakpoint(pc);
2815b81b6b3SRodney W. Grimes }
2825b81b6b3SRodney W. Grimes 
2835b81b6b3SRodney W. Grimes void
28437224cd3SMarcel Moolenaar db_clear_single_step(void)
2855b81b6b3SRodney W. Grimes {
2865b81b6b3SRodney W. Grimes 
2875b81b6b3SRodney W. Grimes 	if (db_not_taken_bkpt != 0) {
2885b81b6b3SRodney W. Grimes 		db_delete_temp_breakpoint(db_not_taken_bkpt);
2895b81b6b3SRodney W. Grimes 		db_not_taken_bkpt = 0;
2905b81b6b3SRodney W. Grimes 	}
29146e5fdffSDoug Rabson 	if (db_taken_bkpt != 0) {
29246e5fdffSDoug Rabson 		db_delete_temp_breakpoint(db_taken_bkpt);
29346e5fdffSDoug Rabson 		db_taken_bkpt = 0;
29446e5fdffSDoug Rabson 	}
2955b81b6b3SRodney W. Grimes }
2965b81b6b3SRodney W. Grimes 
29768016904SDavid E. O'Brien #endif	/* SOFTWARE_SSTEP */
2985b81b6b3SRodney W. Grimes 
2995b81b6b3SRodney W. Grimes extern int	db_cmd_loop_done;
3005b81b6b3SRodney W. Grimes 
3015b81b6b3SRodney W. Grimes /* single-step */
3025b81b6b3SRodney W. Grimes /*ARGSUSED*/
3035b81b6b3SRodney W. Grimes void
3045b81b6b3SRodney W. Grimes db_single_step_cmd(addr, have_addr, count, modif)
3055b81b6b3SRodney W. Grimes 	db_expr_t	addr;
306058284fcSBruce Evans 	boolean_t	have_addr;
3075b81b6b3SRodney W. Grimes 	db_expr_t	count;
3085b81b6b3SRodney W. Grimes 	char *		modif;
3095b81b6b3SRodney W. Grimes {
3105b81b6b3SRodney W. Grimes 	boolean_t	print = FALSE;
3115b81b6b3SRodney W. Grimes 
3125b81b6b3SRodney W. Grimes 	if (count == -1)
3135b81b6b3SRodney W. Grimes 	    count = 1;
3145b81b6b3SRodney W. Grimes 
3155b81b6b3SRodney W. Grimes 	if (modif[0] == 'p')
3165b81b6b3SRodney W. Grimes 	    print = TRUE;
3175b81b6b3SRodney W. Grimes 
3185b81b6b3SRodney W. Grimes 	db_run_mode = STEP_ONCE;
3195b81b6b3SRodney W. Grimes 	db_loop_count = count;
3205b81b6b3SRodney W. Grimes 	db_sstep_print = print;
3215b81b6b3SRodney W. Grimes 	db_inst_count = 0;
3225b81b6b3SRodney W. Grimes 	db_load_count = 0;
3235b81b6b3SRodney W. Grimes 	db_store_count = 0;
3245b81b6b3SRodney W. Grimes 
3255b81b6b3SRodney W. Grimes 	db_cmd_loop_done = 1;
3265b81b6b3SRodney W. Grimes }
3275b81b6b3SRodney W. Grimes 
3285b81b6b3SRodney W. Grimes /* trace and print until call/return */
3295b81b6b3SRodney W. Grimes /*ARGSUSED*/
3305b81b6b3SRodney W. Grimes void
3315b81b6b3SRodney W. Grimes db_trace_until_call_cmd(addr, have_addr, count, modif)
3325b81b6b3SRodney W. Grimes 	db_expr_t	addr;
333058284fcSBruce Evans 	boolean_t	have_addr;
3345b81b6b3SRodney W. Grimes 	db_expr_t	count;
3355b81b6b3SRodney W. Grimes 	char *		modif;
3365b81b6b3SRodney W. Grimes {
3375b81b6b3SRodney W. Grimes 	boolean_t	print = FALSE;
3385b81b6b3SRodney W. Grimes 
3395b81b6b3SRodney W. Grimes 	if (modif[0] == 'p')
3405b81b6b3SRodney W. Grimes 	    print = TRUE;
3415b81b6b3SRodney W. Grimes 
3425b81b6b3SRodney W. Grimes 	db_run_mode = STEP_CALLT;
3435b81b6b3SRodney W. Grimes 	db_sstep_print = print;
3445b81b6b3SRodney W. Grimes 	db_inst_count = 0;
3455b81b6b3SRodney W. Grimes 	db_load_count = 0;
3465b81b6b3SRodney W. Grimes 	db_store_count = 0;
3475b81b6b3SRodney W. Grimes 
3485b81b6b3SRodney W. Grimes 	db_cmd_loop_done = 1;
3495b81b6b3SRodney W. Grimes }
3505b81b6b3SRodney W. Grimes 
3515b81b6b3SRodney W. Grimes /*ARGSUSED*/
3525b81b6b3SRodney W. Grimes void
3535b81b6b3SRodney W. Grimes db_trace_until_matching_cmd(addr, have_addr, count, modif)
3545b81b6b3SRodney W. Grimes 	db_expr_t	addr;
355058284fcSBruce Evans 	boolean_t	have_addr;
3565b81b6b3SRodney W. Grimes 	db_expr_t	count;
3575b81b6b3SRodney W. Grimes 	char *		modif;
3585b81b6b3SRodney W. Grimes {
3595b81b6b3SRodney W. Grimes 	boolean_t	print = FALSE;
3605b81b6b3SRodney W. Grimes 
3615b81b6b3SRodney W. Grimes 	if (modif[0] == 'p')
3625b81b6b3SRodney W. Grimes 	    print = TRUE;
3635b81b6b3SRodney W. Grimes 
3645b81b6b3SRodney W. Grimes 	db_run_mode = STEP_RETURN;
3655b81b6b3SRodney W. Grimes 	db_call_depth = 1;
3665b81b6b3SRodney W. Grimes 	db_sstep_print = print;
3675b81b6b3SRodney W. Grimes 	db_inst_count = 0;
3685b81b6b3SRodney W. Grimes 	db_load_count = 0;
3695b81b6b3SRodney W. Grimes 	db_store_count = 0;
3705b81b6b3SRodney W. Grimes 
3715b81b6b3SRodney W. Grimes 	db_cmd_loop_done = 1;
3725b81b6b3SRodney W. Grimes }
3735b81b6b3SRodney W. Grimes 
3745b81b6b3SRodney W. Grimes /* continue */
3755b81b6b3SRodney W. Grimes /*ARGSUSED*/
3765b81b6b3SRodney W. Grimes void
3775b81b6b3SRodney W. Grimes db_continue_cmd(addr, have_addr, count, modif)
3785b81b6b3SRodney W. Grimes 	db_expr_t	addr;
379058284fcSBruce Evans 	boolean_t	have_addr;
3805b81b6b3SRodney W. Grimes 	db_expr_t	count;
3815b81b6b3SRodney W. Grimes 	char *		modif;
3825b81b6b3SRodney W. Grimes {
3835b81b6b3SRodney W. Grimes 	if (modif[0] == 'c')
3845b81b6b3SRodney W. Grimes 	    db_run_mode = STEP_COUNT;
3855b81b6b3SRodney W. Grimes 	else
3865b81b6b3SRodney W. Grimes 	    db_run_mode = STEP_CONTINUE;
3875b81b6b3SRodney W. Grimes 	db_inst_count = 0;
3885b81b6b3SRodney W. Grimes 	db_load_count = 0;
3895b81b6b3SRodney W. Grimes 	db_store_count = 0;
3905b81b6b3SRodney W. Grimes 
3915b81b6b3SRodney W. Grimes 	db_cmd_loop_done = 1;
3925b81b6b3SRodney W. Grimes }
393