15b81b6b3SRodney W. Grimes /* 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 * HISTORY 285b81b6b3SRodney W. Grimes * $Log: db_run.c,v $ 295b81b6b3SRodney W. Grimes * Revision 1.1 1992/03/25 21:45:24 pace 305b81b6b3SRodney W. Grimes * Initial revision 315b81b6b3SRodney W. Grimes * 325b81b6b3SRodney W. Grimes * Revision 2.5 91/02/05 17:06:58 mrt 335b81b6b3SRodney W. Grimes * Changed to new Mach copyright 345b81b6b3SRodney W. Grimes * [91/01/31 16:19:05 mrt] 355b81b6b3SRodney W. Grimes * 365b81b6b3SRodney W. Grimes * Revision 2.4 91/01/08 15:09:10 rpd 375b81b6b3SRodney W. Grimes * Fixed bug in db_restart_at_pc. 385b81b6b3SRodney W. Grimes * [90/12/07 rpd] 395b81b6b3SRodney W. Grimes * Added STEP_COUNT and count option to db_continue_cmd. 405b81b6b3SRodney W. Grimes * Changed db_stop_at_pc to return (modified) is_breakpoint. 415b81b6b3SRodney W. Grimes * Fixed db_stop_at_pc to print newlines in the right places. 425b81b6b3SRodney W. Grimes * [90/11/27 rpd] 435b81b6b3SRodney W. Grimes * 445b81b6b3SRodney W. Grimes * Revision 2.3 90/10/25 14:43:59 rwd 455b81b6b3SRodney W. Grimes * Changed db_find_breakpoint to db_find_breakpoint_here. 465b81b6b3SRodney W. Grimes * [90/10/18 rpd] 475b81b6b3SRodney W. Grimes * 485b81b6b3SRodney W. Grimes * Fixed db_set_single_step to pass regs to branch_taken. 495b81b6b3SRodney W. Grimes * Added watchpoint argument to db_restart_at_pc. 505b81b6b3SRodney W. Grimes * [90/10/17 rpd] 515b81b6b3SRodney W. Grimes * Generalized the watchpoint support. 525b81b6b3SRodney W. Grimes * [90/10/16 rwd] 535b81b6b3SRodney W. Grimes * Added watchpoint support. 545b81b6b3SRodney W. Grimes * [90/10/16 rpd] 555b81b6b3SRodney W. Grimes * 565b81b6b3SRodney W. Grimes * Revision 2.2 90/08/27 21:51:59 dbg 575b81b6b3SRodney W. Grimes * Fixed names for single-step functions. 585b81b6b3SRodney W. Grimes * [90/08/20 af] 595b81b6b3SRodney W. Grimes * Reduce lint. 605b81b6b3SRodney W. Grimes * [90/08/07 dbg] 615b81b6b3SRodney W. Grimes * Created. 625b81b6b3SRodney W. Grimes * [90/07/25 dbg] 635b81b6b3SRodney W. Grimes * 645b81b6b3SRodney W. Grimes */ 655b81b6b3SRodney W. Grimes /* 665b81b6b3SRodney W. Grimes * Author: David B. Golub, Carnegie Mellon University 675b81b6b3SRodney W. Grimes * Date: 7/90 685b81b6b3SRodney W. Grimes */ 695b81b6b3SRodney W. Grimes 705b81b6b3SRodney W. Grimes /* 715b81b6b3SRodney W. Grimes * Commands to run process. 725b81b6b3SRodney W. Grimes */ 735b81b6b3SRodney W. Grimes #include "param.h" 745b81b6b3SRodney W. Grimes #include "proc.h" 755b81b6b3SRodney W. Grimes #include <machine/db_machdep.h> 765b81b6b3SRodney W. Grimes 775b81b6b3SRodney W. Grimes #include <ddb/db_lex.h> 785b81b6b3SRodney W. Grimes #include <ddb/db_break.h> 795b81b6b3SRodney W. Grimes #include <ddb/db_access.h> 805b81b6b3SRodney W. Grimes 815b81b6b3SRodney W. Grimes int db_run_mode; 825b81b6b3SRodney W. Grimes #define STEP_NONE 0 835b81b6b3SRodney W. Grimes #define STEP_ONCE 1 845b81b6b3SRodney W. Grimes #define STEP_RETURN 2 855b81b6b3SRodney W. Grimes #define STEP_CALLT 3 865b81b6b3SRodney W. Grimes #define STEP_CONTINUE 4 875b81b6b3SRodney W. Grimes #define STEP_INVISIBLE 5 885b81b6b3SRodney W. Grimes #define STEP_COUNT 6 895b81b6b3SRodney W. Grimes 905b81b6b3SRodney W. Grimes boolean_t db_sstep_print; 915b81b6b3SRodney W. Grimes int db_loop_count; 925b81b6b3SRodney W. Grimes int db_call_depth; 935b81b6b3SRodney W. Grimes 945b81b6b3SRodney W. Grimes int db_inst_count; 955b81b6b3SRodney W. Grimes int db_load_count; 965b81b6b3SRodney W. Grimes int db_store_count; 975b81b6b3SRodney W. Grimes 985b81b6b3SRodney W. Grimes #ifndef db_set_single_step 995b81b6b3SRodney W. Grimes void db_set_single_step(/* db_regs_t *regs */); /* forward */ 1005b81b6b3SRodney W. Grimes #endif 1015b81b6b3SRodney W. Grimes #ifndef db_clear_single_step 1025b81b6b3SRodney W. Grimes void db_clear_single_step(/* db_regs_t *regs */); 1035b81b6b3SRodney W. Grimes #endif 1045b81b6b3SRodney W. Grimes 1055b81b6b3SRodney W. Grimes boolean_t 1065b81b6b3SRodney W. Grimes db_stop_at_pc(is_breakpoint) 1075b81b6b3SRodney W. Grimes boolean_t *is_breakpoint; 1085b81b6b3SRodney W. Grimes { 1095b81b6b3SRodney W. Grimes register db_addr_t pc; 1105b81b6b3SRodney W. Grimes register db_breakpoint_t bkpt; 1115b81b6b3SRodney W. Grimes 1125b81b6b3SRodney W. Grimes db_clear_single_step(DDB_REGS); 1135b81b6b3SRodney W. Grimes db_clear_breakpoints(); 1145b81b6b3SRodney W. Grimes db_clear_watchpoints(); 1155b81b6b3SRodney W. Grimes pc = PC_REGS(DDB_REGS); 1165b81b6b3SRodney W. Grimes 1175b81b6b3SRodney W. Grimes #ifdef FIXUP_PC_AFTER_BREAK 1185b81b6b3SRodney W. Grimes if (*is_breakpoint) { 1195b81b6b3SRodney W. Grimes /* 1205b81b6b3SRodney W. Grimes * Breakpoint trap. Fix up the PC if the 1215b81b6b3SRodney W. Grimes * machine requires it. 1225b81b6b3SRodney W. Grimes */ 1235b81b6b3SRodney W. Grimes FIXUP_PC_AFTER_BREAK 1245b81b6b3SRodney W. Grimes pc = PC_REGS(DDB_REGS); 1255b81b6b3SRodney W. Grimes } 1265b81b6b3SRodney W. Grimes #endif 1275b81b6b3SRodney W. Grimes 1285b81b6b3SRodney W. Grimes /* 1295b81b6b3SRodney W. Grimes * Now check for a breakpoint at this address. 1305b81b6b3SRodney W. Grimes */ 1315b81b6b3SRodney W. Grimes bkpt = db_find_breakpoint_here(pc); 1325b81b6b3SRodney W. Grimes if (bkpt) { 1335b81b6b3SRodney W. Grimes if (--bkpt->count == 0) { 1345b81b6b3SRodney W. Grimes bkpt->count = bkpt->init_count; 1355b81b6b3SRodney W. Grimes *is_breakpoint = TRUE; 1365b81b6b3SRodney W. Grimes return (TRUE); /* stop here */ 1375b81b6b3SRodney W. Grimes } 1385b81b6b3SRodney W. Grimes } else if (*is_breakpoint) { 1395b81b6b3SRodney W. Grimes ddb_regs.tf_eip += 1; 1405b81b6b3SRodney W. Grimes } 1415b81b6b3SRodney W. Grimes 1425b81b6b3SRodney W. Grimes *is_breakpoint = FALSE; 1435b81b6b3SRodney W. Grimes 1445b81b6b3SRodney W. Grimes if (db_run_mode == STEP_INVISIBLE) { 1455b81b6b3SRodney W. Grimes db_run_mode = STEP_CONTINUE; 1465b81b6b3SRodney W. Grimes return (FALSE); /* continue */ 1475b81b6b3SRodney W. Grimes } 1485b81b6b3SRodney W. Grimes if (db_run_mode == STEP_COUNT) { 1495b81b6b3SRodney W. Grimes return (FALSE); /* continue */ 1505b81b6b3SRodney W. Grimes } 1515b81b6b3SRodney W. Grimes if (db_run_mode == STEP_ONCE) { 1525b81b6b3SRodney W. Grimes if (--db_loop_count > 0) { 1535b81b6b3SRodney W. Grimes if (db_sstep_print) { 1545b81b6b3SRodney W. Grimes db_printf("\t\t"); 1555b81b6b3SRodney W. Grimes db_print_loc_and_inst(pc); 1565b81b6b3SRodney W. Grimes db_printf("\n"); 1575b81b6b3SRodney W. Grimes } 1585b81b6b3SRodney W. Grimes return (FALSE); /* continue */ 1595b81b6b3SRodney W. Grimes } 1605b81b6b3SRodney W. Grimes } 1615b81b6b3SRodney W. Grimes if (db_run_mode == STEP_RETURN) { 1625b81b6b3SRodney W. Grimes db_expr_t ins = db_get_value(pc, sizeof(int), FALSE); 1635b81b6b3SRodney W. Grimes 1645b81b6b3SRodney W. Grimes /* continue until matching return */ 1655b81b6b3SRodney W. Grimes 1665b81b6b3SRodney W. Grimes if (!inst_trap_return(ins) && 1675b81b6b3SRodney W. Grimes (!inst_return(ins) || --db_call_depth != 0)) { 1685b81b6b3SRodney W. Grimes if (db_sstep_print) { 1695b81b6b3SRodney W. Grimes if (inst_call(ins) || inst_return(ins)) { 1705b81b6b3SRodney W. Grimes register int i; 1715b81b6b3SRodney W. Grimes 1725b81b6b3SRodney W. Grimes db_printf("[after %6d] ", db_inst_count); 1735b81b6b3SRodney W. Grimes for (i = db_call_depth; --i > 0; ) 1745b81b6b3SRodney W. Grimes db_printf(" "); 1755b81b6b3SRodney W. Grimes db_print_loc_and_inst(pc); 1765b81b6b3SRodney W. Grimes db_printf("\n"); 1775b81b6b3SRodney W. Grimes } 1785b81b6b3SRodney W. Grimes } 1795b81b6b3SRodney W. Grimes if (inst_call(ins)) 1805b81b6b3SRodney W. Grimes db_call_depth++; 1815b81b6b3SRodney W. Grimes return (FALSE); /* continue */ 1825b81b6b3SRodney W. Grimes } 1835b81b6b3SRodney W. Grimes } 1845b81b6b3SRodney W. Grimes if (db_run_mode == STEP_CALLT) { 1855b81b6b3SRodney W. Grimes db_expr_t ins = db_get_value(pc, sizeof(int), FALSE); 1865b81b6b3SRodney W. Grimes 1875b81b6b3SRodney W. Grimes /* continue until call or return */ 1885b81b6b3SRodney W. Grimes 1895b81b6b3SRodney W. Grimes if (!inst_call(ins) && 1905b81b6b3SRodney W. Grimes !inst_return(ins) && 1915b81b6b3SRodney W. Grimes !inst_trap_return(ins)) { 1925b81b6b3SRodney W. Grimes return (FALSE); /* continue */ 1935b81b6b3SRodney W. Grimes } 1945b81b6b3SRodney W. Grimes } 1955b81b6b3SRodney W. Grimes db_run_mode = STEP_NONE; 1965b81b6b3SRodney W. Grimes return (TRUE); 1975b81b6b3SRodney W. Grimes } 1985b81b6b3SRodney W. Grimes 1995b81b6b3SRodney W. Grimes void 2005b81b6b3SRodney W. Grimes db_restart_at_pc(watchpt) 2015b81b6b3SRodney W. Grimes boolean_t watchpt; 2025b81b6b3SRodney W. Grimes { 2035b81b6b3SRodney W. Grimes register db_addr_t pc = PC_REGS(DDB_REGS); 2045b81b6b3SRodney W. Grimes 2055b81b6b3SRodney W. Grimes if ((db_run_mode == STEP_COUNT) || 2065b81b6b3SRodney W. Grimes (db_run_mode == STEP_RETURN) || 2075b81b6b3SRodney W. Grimes (db_run_mode == STEP_CALLT)) { 2085b81b6b3SRodney W. Grimes db_expr_t ins; 2095b81b6b3SRodney W. Grimes 2105b81b6b3SRodney W. Grimes /* 2115b81b6b3SRodney W. Grimes * We are about to execute this instruction, 2125b81b6b3SRodney W. Grimes * so count it now. 2135b81b6b3SRodney W. Grimes */ 2145b81b6b3SRodney W. Grimes 2155b81b6b3SRodney W. Grimes ins = db_get_value(pc, sizeof(int), FALSE); 2165b81b6b3SRodney W. Grimes db_inst_count++; 2175b81b6b3SRodney W. Grimes db_load_count += inst_load(ins); 2185b81b6b3SRodney W. Grimes db_store_count += inst_store(ins); 2195b81b6b3SRodney W. Grimes #ifdef SOFTWARE_SSTEP 2205b81b6b3SRodney W. Grimes /* XXX works on mips, but... */ 2215b81b6b3SRodney W. Grimes if (inst_branch(ins) || inst_call(ins)) { 2225b81b6b3SRodney W. Grimes ins = db_get_value(next_instr_address(pc,1), 2235b81b6b3SRodney W. Grimes sizeof(int), FALSE); 2245b81b6b3SRodney W. Grimes db_inst_count++; 2255b81b6b3SRodney W. Grimes db_load_count += inst_load(ins); 2265b81b6b3SRodney W. Grimes db_store_count += inst_store(ins); 2275b81b6b3SRodney W. Grimes } 2285b81b6b3SRodney W. Grimes #endif SOFTWARE_SSTEP 2295b81b6b3SRodney W. Grimes } 2305b81b6b3SRodney W. Grimes 2315b81b6b3SRodney W. Grimes if (db_run_mode == STEP_CONTINUE) { 2325b81b6b3SRodney W. Grimes if (watchpt || db_find_breakpoint_here(pc)) { 2335b81b6b3SRodney W. Grimes /* 2345b81b6b3SRodney W. Grimes * Step over breakpoint/watchpoint. 2355b81b6b3SRodney W. Grimes */ 2365b81b6b3SRodney W. Grimes db_run_mode = STEP_INVISIBLE; 2375b81b6b3SRodney W. Grimes db_set_single_step(DDB_REGS); 2385b81b6b3SRodney W. Grimes } else { 2395b81b6b3SRodney W. Grimes db_set_breakpoints(); 2405b81b6b3SRodney W. Grimes db_set_watchpoints(); 2415b81b6b3SRodney W. Grimes } 2425b81b6b3SRodney W. Grimes } else { 2435b81b6b3SRodney W. Grimes db_set_single_step(DDB_REGS); 2445b81b6b3SRodney W. Grimes } 2455b81b6b3SRodney W. Grimes } 2465b81b6b3SRodney W. Grimes 2475b81b6b3SRodney W. Grimes void 2485b81b6b3SRodney W. Grimes db_single_step(regs) 2495b81b6b3SRodney W. Grimes db_regs_t *regs; 2505b81b6b3SRodney W. Grimes { 2515b81b6b3SRodney W. Grimes if (db_run_mode == STEP_CONTINUE) { 2525b81b6b3SRodney W. Grimes db_run_mode = STEP_INVISIBLE; 2535b81b6b3SRodney W. Grimes db_set_single_step(regs); 2545b81b6b3SRodney W. Grimes } 2555b81b6b3SRodney W. Grimes } 2565b81b6b3SRodney W. Grimes 2575b81b6b3SRodney W. Grimes #ifdef SOFTWARE_SSTEP 2585b81b6b3SRodney W. Grimes /* 2595b81b6b3SRodney W. Grimes * Software implementation of single-stepping. 2605b81b6b3SRodney W. Grimes * If your machine does not have a trace mode 2615b81b6b3SRodney W. Grimes * similar to the vax or sun ones you can use 2625b81b6b3SRodney W. Grimes * this implementation, done for the mips. 2635b81b6b3SRodney W. Grimes * Just define the above conditional and provide 2645b81b6b3SRodney W. Grimes * the functions/macros defined below. 2655b81b6b3SRodney W. Grimes * 2665b81b6b3SRodney W. Grimes * extern boolean_t 2675b81b6b3SRodney W. Grimes * inst_branch(), returns true if the instruction might branch 2685b81b6b3SRodney W. Grimes * extern unsigned 2695b81b6b3SRodney W. Grimes * branch_taken(), return the address the instruction might 2705b81b6b3SRodney W. Grimes * branch to 2715b81b6b3SRodney W. Grimes * db_getreg_val(); return the value of a user register, 2725b81b6b3SRodney W. Grimes * as indicated in the hardware instruction 2735b81b6b3SRodney W. Grimes * encoding, e.g. 8 for r8 2745b81b6b3SRodney W. Grimes * 2755b81b6b3SRodney W. Grimes * next_instr_address(pc,bd) returns the address of the first 2765b81b6b3SRodney W. Grimes * instruction following the one at "pc", 2775b81b6b3SRodney W. Grimes * which is either in the taken path of 2785b81b6b3SRodney W. Grimes * the branch (bd==1) or not. This is 2795b81b6b3SRodney W. Grimes * for machines (mips) with branch delays. 2805b81b6b3SRodney W. Grimes * 2815b81b6b3SRodney W. Grimes * A single-step may involve at most 2 breakpoints - 2825b81b6b3SRodney W. Grimes * one for branch-not-taken and one for branch taken. 2835b81b6b3SRodney W. Grimes * If one of these addresses does not already have a breakpoint, 2845b81b6b3SRodney W. Grimes * we allocate a breakpoint and save it here. 2855b81b6b3SRodney W. Grimes * These breakpoints are deleted on return. 2865b81b6b3SRodney W. Grimes */ 2875b81b6b3SRodney W. Grimes db_breakpoint_t db_not_taken_bkpt = 0; 2885b81b6b3SRodney W. Grimes db_breakpoint_t db_taken_bkpt = 0; 2895b81b6b3SRodney W. Grimes 2905b81b6b3SRodney W. Grimes void 2915b81b6b3SRodney W. Grimes db_set_single_step(regs) 2925b81b6b3SRodney W. Grimes register db_regs_t *regs; 2935b81b6b3SRodney W. Grimes { 2945b81b6b3SRodney W. Grimes db_addr_t pc = PC_REGS(regs); 2955b81b6b3SRodney W. Grimes register unsigned inst, brpc; 2965b81b6b3SRodney W. Grimes 2975b81b6b3SRodney W. Grimes /* 2985b81b6b3SRodney W. Grimes * User was stopped at pc, e.g. the instruction 2995b81b6b3SRodney W. Grimes * at pc was not executed. 3005b81b6b3SRodney W. Grimes */ 3015b81b6b3SRodney W. Grimes inst = db_get_value(pc, sizeof(int), FALSE); 3025b81b6b3SRodney W. Grimes if (inst_branch(inst) || inst_call(inst)) { 3035b81b6b3SRodney W. Grimes extern unsigned getreg_val(); 3045b81b6b3SRodney W. Grimes 3055b81b6b3SRodney W. Grimes brpc = branch_taken(inst, pc, getreg_val, regs); 3065b81b6b3SRodney W. Grimes if (brpc != pc) { /* self-branches are hopeless */ 3075b81b6b3SRodney W. Grimes db_taken_bkpt = db_set_temp_breakpoint(brpc); 3085b81b6b3SRodney W. Grimes } 3095b81b6b3SRodney W. Grimes pc = next_instr_address(pc,1); 3105b81b6b3SRodney W. Grimes } 3115b81b6b3SRodney W. Grimes pc = next_instr_address(pc,0); 3125b81b6b3SRodney W. Grimes db_not_taken_bkpt = db_set_temp_breakpoint(pc); 3135b81b6b3SRodney W. Grimes } 3145b81b6b3SRodney W. Grimes 3155b81b6b3SRodney W. Grimes void 3165b81b6b3SRodney W. Grimes db_clear_single_step(regs) 3175b81b6b3SRodney W. Grimes db_regs_t *regs; 3185b81b6b3SRodney W. Grimes { 3195b81b6b3SRodney W. Grimes register db_breakpoint_t bkpt; 3205b81b6b3SRodney W. Grimes 3215b81b6b3SRodney W. Grimes if (db_taken_bkpt != 0) { 3225b81b6b3SRodney W. Grimes db_delete_temp_breakpoint(db_taken_bkpt); 3235b81b6b3SRodney W. Grimes db_taken_bkpt = 0; 3245b81b6b3SRodney W. Grimes } 3255b81b6b3SRodney W. Grimes if (db_not_taken_bkpt != 0) { 3265b81b6b3SRodney W. Grimes db_delete_temp_breakpoint(db_not_taken_bkpt); 3275b81b6b3SRodney W. Grimes db_not_taken_bkpt = 0; 3285b81b6b3SRodney W. Grimes } 3295b81b6b3SRodney W. Grimes } 3305b81b6b3SRodney W. Grimes 3315b81b6b3SRodney W. Grimes #endif SOFTWARE_SSTEP 3325b81b6b3SRodney W. Grimes 3335b81b6b3SRodney W. Grimes extern int db_cmd_loop_done; 3345b81b6b3SRodney W. Grimes 3355b81b6b3SRodney W. Grimes /* single-step */ 3365b81b6b3SRodney W. Grimes /*ARGSUSED*/ 3375b81b6b3SRodney W. Grimes void 3385b81b6b3SRodney W. Grimes db_single_step_cmd(addr, have_addr, count, modif) 3395b81b6b3SRodney W. Grimes db_expr_t addr; 3405b81b6b3SRodney W. Grimes int have_addr; 3415b81b6b3SRodney W. Grimes db_expr_t count; 3425b81b6b3SRodney W. Grimes char * modif; 3435b81b6b3SRodney W. Grimes { 3445b81b6b3SRodney W. Grimes boolean_t print = FALSE; 3455b81b6b3SRodney W. Grimes 3465b81b6b3SRodney W. Grimes if (count == -1) 3475b81b6b3SRodney W. Grimes count = 1; 3485b81b6b3SRodney W. Grimes 3495b81b6b3SRodney W. Grimes if (modif[0] == 'p') 3505b81b6b3SRodney W. Grimes print = TRUE; 3515b81b6b3SRodney W. Grimes 3525b81b6b3SRodney W. Grimes db_run_mode = STEP_ONCE; 3535b81b6b3SRodney W. Grimes db_loop_count = count; 3545b81b6b3SRodney W. Grimes db_sstep_print = print; 3555b81b6b3SRodney W. Grimes db_inst_count = 0; 3565b81b6b3SRodney W. Grimes db_load_count = 0; 3575b81b6b3SRodney W. Grimes db_store_count = 0; 3585b81b6b3SRodney W. Grimes 3595b81b6b3SRodney W. Grimes db_cmd_loop_done = 1; 3605b81b6b3SRodney W. Grimes } 3615b81b6b3SRodney W. Grimes 3625b81b6b3SRodney W. Grimes /* trace and print until call/return */ 3635b81b6b3SRodney W. Grimes /*ARGSUSED*/ 3645b81b6b3SRodney W. Grimes void 3655b81b6b3SRodney W. Grimes db_trace_until_call_cmd(addr, have_addr, count, modif) 3665b81b6b3SRodney W. Grimes db_expr_t addr; 3675b81b6b3SRodney W. Grimes int have_addr; 3685b81b6b3SRodney W. Grimes db_expr_t count; 3695b81b6b3SRodney W. Grimes char * modif; 3705b81b6b3SRodney W. Grimes { 3715b81b6b3SRodney W. Grimes boolean_t print = FALSE; 3725b81b6b3SRodney W. Grimes 3735b81b6b3SRodney W. Grimes if (modif[0] == 'p') 3745b81b6b3SRodney W. Grimes print = TRUE; 3755b81b6b3SRodney W. Grimes 3765b81b6b3SRodney W. Grimes db_run_mode = STEP_CALLT; 3775b81b6b3SRodney W. Grimes db_sstep_print = print; 3785b81b6b3SRodney W. Grimes db_inst_count = 0; 3795b81b6b3SRodney W. Grimes db_load_count = 0; 3805b81b6b3SRodney W. Grimes db_store_count = 0; 3815b81b6b3SRodney W. Grimes 3825b81b6b3SRodney W. Grimes db_cmd_loop_done = 1; 3835b81b6b3SRodney W. Grimes } 3845b81b6b3SRodney W. Grimes 3855b81b6b3SRodney W. Grimes /*ARGSUSED*/ 3865b81b6b3SRodney W. Grimes void 3875b81b6b3SRodney W. Grimes db_trace_until_matching_cmd(addr, have_addr, count, modif) 3885b81b6b3SRodney W. Grimes db_expr_t addr; 3895b81b6b3SRodney W. Grimes int have_addr; 3905b81b6b3SRodney W. Grimes db_expr_t count; 3915b81b6b3SRodney W. Grimes char * modif; 3925b81b6b3SRodney W. Grimes { 3935b81b6b3SRodney W. Grimes boolean_t print = FALSE; 3945b81b6b3SRodney W. Grimes 3955b81b6b3SRodney W. Grimes if (modif[0] == 'p') 3965b81b6b3SRodney W. Grimes print = TRUE; 3975b81b6b3SRodney W. Grimes 3985b81b6b3SRodney W. Grimes db_run_mode = STEP_RETURN; 3995b81b6b3SRodney W. Grimes db_call_depth = 1; 4005b81b6b3SRodney W. Grimes db_sstep_print = print; 4015b81b6b3SRodney W. Grimes db_inst_count = 0; 4025b81b6b3SRodney W. Grimes db_load_count = 0; 4035b81b6b3SRodney W. Grimes db_store_count = 0; 4045b81b6b3SRodney W. Grimes 4055b81b6b3SRodney W. Grimes db_cmd_loop_done = 1; 4065b81b6b3SRodney W. Grimes } 4075b81b6b3SRodney W. Grimes 4085b81b6b3SRodney W. Grimes /* continue */ 4095b81b6b3SRodney W. Grimes /*ARGSUSED*/ 4105b81b6b3SRodney W. Grimes void 4115b81b6b3SRodney W. Grimes db_continue_cmd(addr, have_addr, count, modif) 4125b81b6b3SRodney W. Grimes db_expr_t addr; 4135b81b6b3SRodney W. Grimes int have_addr; 4145b81b6b3SRodney W. Grimes db_expr_t count; 4155b81b6b3SRodney W. Grimes char * modif; 4165b81b6b3SRodney W. Grimes { 4175b81b6b3SRodney W. Grimes if (modif[0] == 'c') 4185b81b6b3SRodney W. Grimes db_run_mode = STEP_COUNT; 4195b81b6b3SRodney W. Grimes else 4205b81b6b3SRodney W. Grimes db_run_mode = STEP_CONTINUE; 4215b81b6b3SRodney W. Grimes db_inst_count = 0; 4225b81b6b3SRodney W. Grimes db_load_count = 0; 4235b81b6b3SRodney W. Grimes db_store_count = 0; 4245b81b6b3SRodney W. Grimes 4255b81b6b3SRodney W. Grimes db_cmd_loop_done = 1; 4265b81b6b3SRodney W. Grimes } 427