Add -O option: Ignore non-files when recursing.
[dragonfly.git] / sys / ddb / db_trap.c
blob89bf00a3d453d916bffe92c58a11a36baff68cc6
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
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
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
26 * $FreeBSD: src/sys/ddb/db_trap.c,v 1.14 1999/08/28 00:41:11 peter Exp $
27 * $DragonFly: src/sys/ddb/db_trap.c,v 1.3 2003/11/08 03:06:53 dillon Exp $
31 * Author: David B. Golub, Carnegie Mellon University
32 * Date: 7/90
36 * Trap entry point to kernel debugger.
38 #include <sys/param.h>
40 #include <ddb/ddb.h>
41 #include <ddb/db_command.h>
43 #include <setjmp.h>
45 extern jmp_buf db_jmpbuf;
47 void
48 db_trap(type, code)
49 int type, code;
51 boolean_t bkpt;
52 boolean_t watchpt;
54 bkpt = IS_BREAKPOINT_TRAP(type, code);
55 watchpt = IS_WATCHPOINT_TRAP(type, code);
57 if (db_stop_at_pc(&bkpt)) {
58 if (db_inst_count) {
59 db_printf("After %d instructions (%d loads, %d stores),\n",
60 db_inst_count, db_load_count, db_store_count);
62 if (bkpt)
63 db_printf("Breakpoint at\t");
64 else if (watchpt)
65 db_printf("Watchpoint at\t");
66 else
67 db_printf("Stopped at\t");
68 db_dot = PC_REGS(DDB_REGS);
69 if (setjmp(db_jmpbuf) == 0)
70 db_print_loc_and_inst(db_dot, DDB_REGS);
72 db_command_loop();
75 db_restart_at_pc(watchpt);