Annotation of Net2/ddb/db_trap.c, revision 1.1.1.2

1.1       root        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
                      9:  * software, derivative works or modified versions, and any portions
                     10:  * thereof, and that both notices appear in supporting documentation.
                     11:  * 
                     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.
                     15:  * 
                     16:  * Carnegie Mellon requests users of this software to return to
                     17:  * 
                     18:  *  Software Distribution Coordinator  or  [email protected]
                     19:  *  School of Computer Science
                     20:  *  Carnegie Mellon University
                     21:  *  Pittsburgh PA 15213-3890
                     22:  * 
                     23:  * any improvements or extensions that they make and grant Carnegie the
                     24:  * rights to redistribute these changes.
                     25:  */
                     26: /*
                     27:  * HISTORY
                     28:  * $Log: db_trap.c,v $
1.1.1.2 ! root       29:  * Revision 1.1.1.1  1993/03/21 09:46:27  cgd
        !            30:  * initial import of 386bsd-0.1 sources
        !            31:  *
1.1       root       32:  * Revision 1.1  1992/03/25  21:45:31  pace
                     33:  * Initial revision
                     34:  *
                     35:  * Revision 2.5  91/02/05  17:07:16  mrt
                     36:  *     Changed to new Mach copyright
                     37:  *     [91/01/31  16:19:35  mrt]
                     38:  * 
                     39:  * Revision 2.4  91/01/08  15:09:17  rpd
                     40:  *     Changed db_stop_at_pc's arguments.
                     41:  *     Print db_inst_count, db_load_count, db_store_count.
                     42:  *     [90/11/27            rpd]
                     43:  * 
                     44:  * Revision 2.3  90/10/25  14:44:11  rwd
                     45:  *     From rpd.
                     46:  *     [90/10/19  17:03:17  rwd]
                     47:  * 
                     48:  *     Generalized the watchpoint support.
                     49:  *     [90/10/16            rwd]
                     50:  *     Added watchpoint support.
                     51:  *     [90/10/16            rpd]
                     52:  * 
                     53:  * Revision 2.2  90/08/27  21:52:52  dbg
                     54:  *     Assign to db_dot before calling the print function.
                     55:  *     [90/08/20            af]
                     56:  *     Reduce lint.
                     57:  *     [90/08/07            dbg]
                     58:  *     Created.
                     59:  *     [90/07/25            dbg]
                     60:  * 
                     61:  */
                     62: /*
                     63:  *     Author: David B. Golub, Carnegie Mellon University
                     64:  *     Date:   7/90
                     65:  */
                     66: 
                     67: /*
                     68:  * Trap entry point to kernel debugger.
                     69:  */
                     70: #include "param.h"
                     71: #include "proc.h"
                     72: #include <ddb/db_command.h>
                     73: #include <ddb/db_break.h>
                     74: 
                     75: extern void            db_restart_at_pc();
                     76: extern boolean_t       db_stop_at_pc();
                     77: 
                     78: extern int             db_inst_count;
                     79: extern int             db_load_count;
                     80: extern int             db_store_count;
                     81: 
                     82: db_trap(type, code)
                     83:        int     type, code;
                     84: {
                     85:        boolean_t       bkpt;
                     86:        boolean_t       watchpt;
                     87: 
                     88:        bkpt = IS_BREAKPOINT_TRAP(type, code);
                     89:        watchpt = IS_WATCHPOINT_TRAP(type, code);
                     90: 
                     91:        if (db_stop_at_pc(&bkpt)) {
                     92:            if (db_inst_count) {
                     93:                db_printf("After %d instructions (%d loads, %d stores),\n",
                     94:                          db_inst_count, db_load_count, db_store_count);
                     95:            }
                     96:            if (bkpt)
                     97:                db_printf("Breakpoint at\t");
                     98:            else if (watchpt)
                     99:                db_printf("Watchpoint at\t");
                    100:            else
                    101:                db_printf("Stopped at\t");
                    102:            db_dot = PC_REGS(DDB_REGS);
                    103:            db_print_loc_and_inst(db_dot);
                    104: 
                    105:            db_command_loop();
                    106:        }
                    107: 
                    108:        db_restart_at_pc(watchpt);
                    109: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.