summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include/db_machdep.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-10 23:47:20 +0000
committermarcel <marcel@FreeBSD.org>2004-07-10 23:47:20 +0000
commitaae5483213805c645aad67985fa4f638d6e34915 (patch)
tree533bc344dcaf70d30b9a52c0dc5327488516647b /sys/ia64/include/db_machdep.h
parent1dca995d693b9df1e65a294b6385cc1d442233b1 (diff)
downloadFreeBSD-src-aae5483213805c645aad67985fa4f638d6e34915.zip
FreeBSD-src-aae5483213805c645aad67985fa4f638d6e34915.tar.gz
Mega update for the KDB framework: turn DDB into a KDB backend.
Most of the changes are a direct result of adding thread awareness. Typically, DDB_REGS is gone. All registers are taken from the trapframe and backtraces use the PCB based contexts. DDB_REGS was defined to be a trapframe on all platforms anyway. Thread awareness introduces the following new commands: thread X switch to thread X (where X is the TID), show threads list all threads. The backtrace code has been made more flexible so that one can create backtraces for any thread by giving the thread ID as an argument to trace. With this change, ia64 has support for breakpoints.
Diffstat (limited to 'sys/ia64/include/db_machdep.h')
-rw-r--r--sys/ia64/include/db_machdep.h120
1 files changed, 41 insertions, 79 deletions
diff --git a/sys/ia64/include/db_machdep.h b/sys/ia64/include/db_machdep.h
index 4b801f6..25288cd 100644
--- a/sys/ia64/include/db_machdep.h
+++ b/sys/ia64/include/db_machdep.h
@@ -1,66 +1,64 @@
-/* $FreeBSD$ */
-/* $NetBSD: db_machdep.h,v 1.6 1997/09/06 02:02:25 thorpej Exp $ */
-
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * Carnegie Mellon requests users of this software to return to
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
+ * $FreeBSD$
*/
#ifndef _MACHINE_DB_MACHDEP_H_
#define _MACHINE_DB_MACHDEP_H_
-/*
- * Machine-dependent defines for new kernel debugger.
- */
-
-#include <sys/param.h>
-#include <vm/vm.h>
-#include <machine/frame.h>
#include <machine/ia64_cpu.h>
-#define DB_NO_AOUT
+/* We define some of our own commands. */
+#define DB_MACHINE_COMMANDS
+
+/* We use Elf64 symbols in DDB. */
+#define DB_ELFSIZE 64
-struct ia64_bundle;
+/* Pretty arbitrary. */
+#define DB_SMALL_VALUE_MAX 0x7fffffff
+#define DB_SMALL_VALUE_MIN (-0x400001)
typedef vm_offset_t db_addr_t; /* address - unsigned */
typedef long db_expr_t; /* expression - signed */
-typedef struct trapframe db_regs_t;
-extern db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-#define PC_REGS(regs) ((db_addr_t)(regs)->tf_special.iip + \
- (((regs)->tf_special.psr >> 41) & 3))
+#define PC_REGS() ((kdb_thrctx->pcb_special.__spare == 0) ? \
+ kdb_thrctx->pcb_special.rp : \
+ kdb_thrctx->pcb_special.iip + ((kdb_thrctx->pcb_special.psr>>41) & 3))
-#define BKPT_WRITE(addr, storage) db_write_breakpoint(addr, storage)
-#define BKPT_CLEAR(addr, storage) db_clear_breakpoint(addr, storage)
-#define BKPT_INST_TYPE u_int64_t
+#define BKPT_WRITE(addr, storage) db_bkpt_write(addr, storage)
+#define BKPT_CLEAR(addr, storage) db_bkpt_clear(addr, storage)
+#define BKPT_SKIP db_bkpt_skip()
+#define BKPT_INST_TYPE uint64_t
-#define BKPT_SKIP db_skip_breakpoint()
+void db_bkpt_write(db_addr_t, BKPT_INST_TYPE *storage);
+void db_bkpt_clear(db_addr_t, uint64_t *storage);
+void db_bkpt_skip(void);
-#define db_clear_single_step(regs) ddb_regs.tf_special.psr &= ~IA64_PSR_SS
-#define db_set_single_step(regs) ddb_regs.tf_special.psr |= IA64_PSR_SS
+#define db_clear_single_step kdb_cpu_clear_singlestep
+#define db_set_single_step kdb_cpu_set_singlestep
#define IS_BREAKPOINT_TRAP(type, code) (type == IA64_VEC_BREAK)
#define IS_WATCHPOINT_TRAP(type, code) 0
@@ -72,43 +70,7 @@ extern db_regs_t ddb_regs; /* register state */
#define inst_load(ins) (ins & 0)
#define inst_store(ins) (ins & 0)
#define inst_unconditional_flow_transfer(ins) (ins & 0)
-
-#define branch_taken(ins, pc, regs) pc
-
-/*
- * Functions needed for software single-stepping.
- */
-
-/* No delay slots on Alpha. */
-#define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4)))
-u_long db_register_value(db_regs_t *, int);
-int kdb_trap(int vector, struct trapframe *regs);
-
-u_int64_t *db_rse_current_frame(void);
-u_int64_t *db_rse_previous_frame(u_int64_t *bsp, int sof);
-u_int64_t *db_rse_register_address(u_int64_t *bsp, int regno);
-
-void db_read_bundle(db_addr_t addr, struct ia64_bundle *bp);
-void db_write_bundle(db_addr_t addr, struct ia64_bundle *bp);
-void db_write_breakpoint(db_addr_t addr, u_int64_t *storage);
-void db_clear_breakpoint(db_addr_t addr, u_int64_t *storage);
-void db_skip_breakpoint(void);
-
-/*
- * Pretty arbitrary
- */
-#define DB_SMALL_VALUE_MAX 0x7fffffff
-#define DB_SMALL_VALUE_MIN (-0x400001)
-
-/*
- * We define some of our own commands.
- */
-#define DB_MACHINE_COMMANDS
-
-/*
- * We use Elf64 symbols in DDB.
- */
-#define DB_ELFSIZE 64
+#define branch_taken(ins, pc, regs) pc
#endif /* _MACHINE_DB_MACHDEP_H_ */
OpenPOWER on IntegriCloud