Deleted Added
full compact
db_run.c (256281) db_run.c (273265)
1/*-
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the

--- 19 unchanged lines hidden (view full) ---

28 * Date: 7/90
29 */
30
31/*
32 * Commands to run process.
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the

--- 19 unchanged lines hidden (view full) ---

28 * Date: 7/90
29 */
30
31/*
32 * Commands to run process.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: stable/10/sys/ddb/db_run.c 181175 2008-08-02 12:49:43Z cognet $");
36__FBSDID("$FreeBSD: stable/10/sys/ddb/db_run.c 273265 2014-10-18 19:22:59Z pfg $");
37
38#include <sys/param.h>
39#include <sys/kdb.h>
40#include <sys/proc.h>
41
42#include <machine/kdb.h>
43#include <machine/pcb.h>
44

--- 4 unchanged lines hidden (view full) ---

49#include <ddb/db_access.h>
50
51static int db_run_mode;
52#define STEP_NONE 0
53#define STEP_ONCE 1
54#define STEP_RETURN 2
55#define STEP_CALLT 3
56#define STEP_CONTINUE 4
37
38#include <sys/param.h>
39#include <sys/kdb.h>
40#include <sys/proc.h>
41
42#include <machine/kdb.h>
43#include <machine/pcb.h>
44

--- 4 unchanged lines hidden (view full) ---

49#include <ddb/db_access.h>
50
51static int db_run_mode;
52#define STEP_NONE 0
53#define STEP_ONCE 1
54#define STEP_RETURN 2
55#define STEP_CALLT 3
56#define STEP_CONTINUE 4
57#define STEP_INVISIBLE 5
57#define STEP_INVISIBLE 5
58#define STEP_COUNT 6
59
60static boolean_t db_sstep_print;
61static int db_loop_count;
62static int db_call_depth;
63
64int db_inst_count;
65int db_load_count;

--- 7 unchanged lines hidden (view full) ---

73#endif
74
75#ifdef SOFTWARE_SSTEP
76db_breakpoint_t db_not_taken_bkpt = 0;
77db_breakpoint_t db_taken_bkpt = 0;
78#endif
79
80boolean_t
58#define STEP_COUNT 6
59
60static boolean_t db_sstep_print;
61static int db_loop_count;
62static int db_call_depth;
63
64int db_inst_count;
65int db_load_count;

--- 7 unchanged lines hidden (view full) ---

73#endif
74
75#ifdef SOFTWARE_SSTEP
76db_breakpoint_t db_not_taken_bkpt = 0;
77db_breakpoint_t db_taken_bkpt = 0;
78#endif
79
80boolean_t
81db_stop_at_pc(is_breakpoint)
82 boolean_t *is_breakpoint;
81db_stop_at_pc(boolean_t *is_breakpoint)
83{
84 register db_addr_t pc;
85 register db_breakpoint_t bkpt;
86
87 pc = PC_REGS();
88#ifdef SOFTWARE_SSTEP
89 if ((db_not_taken_bkpt != 0 && pc == db_not_taken_bkpt->address)
90 || (db_taken_bkpt != 0 && pc == db_taken_bkpt->address))

--- 84 unchanged lines hidden (view full) ---

175 return (FALSE); /* continue */
176 }
177 }
178 db_run_mode = STEP_NONE;
179 return (TRUE);
180}
181
182void
82{
83 register db_addr_t pc;
84 register db_breakpoint_t bkpt;
85
86 pc = PC_REGS();
87#ifdef SOFTWARE_SSTEP
88 if ((db_not_taken_bkpt != 0 && pc == db_not_taken_bkpt->address)
89 || (db_taken_bkpt != 0 && pc == db_taken_bkpt->address))

--- 84 unchanged lines hidden (view full) ---

174 return (FALSE); /* continue */
175 }
176 }
177 db_run_mode = STEP_NONE;
178 return (TRUE);
179}
180
181void
183db_restart_at_pc(watchpt)
184 boolean_t watchpt;
182db_restart_at_pc(boolean_t watchpt)
185{
186 register db_addr_t pc = PC_REGS();
187
188 if ((db_run_mode == STEP_COUNT) ||
189 (db_run_mode == STEP_RETURN) ||
190 (db_run_mode == STEP_CALLT)) {
191 db_expr_t ins;
192

--- 130 unchanged lines hidden (view full) ---

323 db_store_count = 0;
324
325 db_cmd_loop_done = 1;
326}
327
328/* trace and print until call/return */
329/*ARGSUSED*/
330void
183{
184 register db_addr_t pc = PC_REGS();
185
186 if ((db_run_mode == STEP_COUNT) ||
187 (db_run_mode == STEP_RETURN) ||
188 (db_run_mode == STEP_CALLT)) {
189 db_expr_t ins;
190

--- 130 unchanged lines hidden (view full) ---

321 db_store_count = 0;
322
323 db_cmd_loop_done = 1;
324}
325
326/* trace and print until call/return */
327/*ARGSUSED*/
328void
331db_trace_until_call_cmd(addr, have_addr, count, modif)
332 db_expr_t addr;
333 boolean_t have_addr;
334 db_expr_t count;
335 char * modif;
329db_trace_until_call_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
330 char *modif)
336{
337 boolean_t print = FALSE;
338
339 if (modif[0] == 'p')
340 print = TRUE;
341
342 db_run_mode = STEP_CALLT;
343 db_sstep_print = print;
344 db_inst_count = 0;
345 db_load_count = 0;
346 db_store_count = 0;
347
348 db_cmd_loop_done = 1;
349}
350
351/*ARGSUSED*/
352void
331{
332 boolean_t print = FALSE;
333
334 if (modif[0] == 'p')
335 print = TRUE;
336
337 db_run_mode = STEP_CALLT;
338 db_sstep_print = print;
339 db_inst_count = 0;
340 db_load_count = 0;
341 db_store_count = 0;
342
343 db_cmd_loop_done = 1;
344}
345
346/*ARGSUSED*/
347void
353db_trace_until_matching_cmd(addr, have_addr, count, modif)
354 db_expr_t addr;
355 boolean_t have_addr;
356 db_expr_t count;
357 char * modif;
348db_trace_until_matching_cmd(db_expr_t addr, boolean_t have_addr,
349 db_expr_t count, char *modif)
358{
359 boolean_t print = FALSE;
360
361 if (modif[0] == 'p')
362 print = TRUE;
363
364 db_run_mode = STEP_RETURN;
365 db_call_depth = 1;
366 db_sstep_print = print;
367 db_inst_count = 0;
368 db_load_count = 0;
369 db_store_count = 0;
370
371 db_cmd_loop_done = 1;
372}
373
374/* continue */
375/*ARGSUSED*/
376void
350{
351 boolean_t print = FALSE;
352
353 if (modif[0] == 'p')
354 print = TRUE;
355
356 db_run_mode = STEP_RETURN;
357 db_call_depth = 1;
358 db_sstep_print = print;
359 db_inst_count = 0;
360 db_load_count = 0;
361 db_store_count = 0;
362
363 db_cmd_loop_done = 1;
364}
365
366/* continue */
367/*ARGSUSED*/
368void
377db_continue_cmd(addr, have_addr, count, modif)
378 db_expr_t addr;
379 boolean_t have_addr;
380 db_expr_t count;
381 char * modif;
369db_continue_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
370 char *modif)
382{
383 if (modif[0] == 'c')
384 db_run_mode = STEP_COUNT;
385 else
386 db_run_mode = STEP_CONTINUE;
387 db_inst_count = 0;
388 db_load_count = 0;
389 db_store_count = 0;
390
391 db_cmd_loop_done = 1;
392}
371{
372 if (modif[0] == 'c')
373 db_run_mode = STEP_COUNT;
374 else
375 db_run_mode = STEP_CONTINUE;
376 db_inst_count = 0;
377 db_load_count = 0;
378 db_store_count = 0;
379
380 db_cmd_loop_done = 1;
381}