db_machdep.h revision 1.4
1/* $OpenBSD: db_machdep.h,v 1.4 2019/11/07 14:44:52 mpi Exp $ */ 2/* $NetBSD: db_machdep.h,v 1.5 2001/11/22 18:00:00 thorpej Exp $ */ 3 4/* 5 * Copyright (c) 1996 Scott K Stevens 6 * 7 * Mach Operating System 8 * Copyright (c) 1991,1990 Carnegie Mellon University 9 * All Rights Reserved. 10 * 11 * Permission to use, copy, modify and distribute this software and its 12 * documentation is hereby granted, provided that both the copyright 13 * notice and this permission notice appear in all copies of the 14 * software, derivative works or modified versions, and any portions 15 * thereof, and that both notices appear in supporting documentation. 16 * 17 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 18 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 19 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 20 * 21 * Carnegie Mellon requests users of this software to return to 22 * 23 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 24 * School of Computer Science 25 * Carnegie Mellon University 26 * Pittsburgh PA 15213-3890 27 * 28 * any improvements or extensions that they make and grant Carnegie Mellon 29 * the rights to redistribute these changes. 30 */ 31 32#ifndef _MACHINE_DB_MACHDEP_H_ 33#define _MACHINE_DB_MACHDEP_H_ 34 35/* 36 * Machine-dependent defines for new kernel debugger. 37 */ 38 39#include <sys/param.h> 40#include <uvm/uvm_extern.h> 41#include <machine/armreg.h> 42#include <machine/frame.h> 43#include <machine/trap.h> 44 45/* end of mangling */ 46 47typedef vaddr_t db_addr_t; /* address - unsigned */ 48typedef long db_expr_t; /* expression - signed */ 49 50typedef trapframe_t db_regs_t; 51 52extern db_regs_t ddb_regs; /* register state */ 53#define DDB_REGS (&ddb_regs) 54 55#define PC_REGS(regs) ((vaddr_t)(regs)->tf_lr) 56#define SET_PC_REGS(regs, value) (regs)->tf_lr = (register_t)(value) 57 58#define BKPT_INST (KERNEL_BREAKPOINT) /* breakpoint instruction */ 59#define BKPT_SIZE (INSN_SIZE) /* size of breakpoint inst */ 60#define BKPT_SET(inst) (BKPT_INST) 61 62/*#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_lr -= BKPT_SIZE)*/ 63 64#define T_BREAKPOINT (1) 65 66#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT) 67#define IS_WATCHPOINT_TRAP(type, code) (0) 68 69// ALL BROKEN!!! 70#define inst_trap_return(ins) ((ins) == 0 && (ins) == 1) 71#define inst_return(ins) ((ins) == 0 && (ins) == 1) 72 73#define inst_call(ins) ((ins) == 0 && (ins) == 1) 74#define inst_branch(ins) ((ins) == 0 && (ins) == 1) 75#define inst_unconditional_flow_transfer(ins) (0) 76 77#define getreg_val (0) 78#define next_instr_address(pc, bd) ((bd) ? (pc) : ((pc) + INSN_SIZE)) 79 80#define DB_MACHINE_COMMANDS 81 82#define SOFTWARE_SSTEP 83 84vaddr_t db_branch_taken(u_int inst, vaddr_t pc, db_regs_t *regs); 85int kdb_trap (int, db_regs_t *); 86void db_machine_init (void); 87 88#define branch_taken(ins, pc, fun, regs) \ 89 db_branch_taken((ins), (pc), (regs)) 90 91void db_show_frame_cmd(db_expr_t, int, db_expr_t, char *); 92 93#define DDB_STATE_NOT_RUNNING 0 94#define DDB_STATE_RUNNING 1 95#define DDB_STATE_EXITING 2 96 97#endif /* _MACHINE_DB_MACHDEP_H_ */ 98