64-bit db_addr_t makes life much easier now that ddb uses ksyms.

This commit is contained in:
scw 2003-08-10 22:22:31 +00:00
parent 7f2011899c
commit 27479ae035
4 changed files with 24 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.h,v 1.9 2003/04/29 17:07:56 scw Exp $ */
/* $NetBSD: db_machdep.h,v 1.10 2003/08/10 22:22:31 scw Exp $ */
/*
* Mach Operating System
@ -37,7 +37,7 @@
#include <uvm/uvm_extern.h>
#include <machine/trap.h>
typedef vaddr_t db_addr_t; /* address - unsigned */
typedef uint64_t db_addr_t; /* address - unsigned */
typedef int64_t db_expr_t; /* expression - signed */
typedef u_int32_t opcode_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_disasm.c,v 1.13 2003/07/15 03:36:00 lukem Exp $ */
/* $NetBSD: db_disasm.c,v 1.14 2003/08/10 22:22:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.13 2003/07/15 03:36:00 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.14 2003/08/10 22:22:31 scw Exp $");
#include "opt_ddb.h"
@ -1100,13 +1100,13 @@ db_disasm(db_addr_t loc, boolean_t dummy)
loc &= ~3;
if (loc < SH5_KSEG0_BASE) {
op = fuword((void *)loc);
op = fuword((void *)(intptr_t)loc);
if (op == 0xffffffff) {
db_printf("invalid address.\n");
return (loc);
}
} else
op = *((opcode_t *)loc);
op = *((opcode_t *)(intptr_t)loc);
extra_info[0] = '\0';
@ -1443,9 +1443,9 @@ sh5_fmt_xsd16_decode_op(int fmt, int op, int d, db_addr_t loc, char *ops)
accmovi |= op;
if ((loc + 4) < SH5_KSEG0_BASE)
nextop = fuword((void *)(loc + 4));
nextop = fuword((void *)(intptr_t)(loc + 4));
else
nextop = *((opcode_t *)(loc + 4));
nextop = *((opcode_t *)(intptr_t)(loc + 4));
if ((nextop & 0xfc00000f) == 0xc8000000 &&
((nextop >> 4) & 0x3f) == d) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_memrw.c,v 1.2 2003/07/15 03:36:00 lukem Exp $ */
/* $NetBSD: db_memrw.c,v 1.3 2003/08/10 22:22:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.2 2003/07/15 03:36:00 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.3 2003/08/10 22:22:31 scw Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -89,7 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.2 2003/07/15 03:36:00 lukem Exp $");
void
db_read_bytes(db_addr_t addr, size_t size, char *data)
{
char *src = (char *)addr;
char *src = (char *)(intptr_t)addr;
if (size == 8) {
*((register_t*)data) = *((register_t*)src);
@ -118,7 +118,7 @@ db_read_bytes(db_addr_t addr, size_t size, char *data)
void
db_write_bytes(db_addr_t addr, size_t size, char *data)
{
char *dst = (char *)addr;
char *dst = (char *)(intptr_t)addr;
extern char etext[];
int in_text = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_trace.c,v 1.11 2003/07/15 03:36:00 lukem Exp $ */
/* $NetBSD: db_trace.c,v 1.12 2003/08/10 22:22:31 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.11 2003/07/15 03:36:00 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.12 2003/08/10 22:22:31 scw Exp $");
#include "opt_ddb.h"
@ -257,9 +257,11 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
* "idle" or "proc_trampoline". The former has no valid
* "context" anyway, and the latter is the first function
* called for each new LWP/kernel thread.
* Likewise for 'Lmapped_start'.
*/
if (strcmp(symp, "idle") == 0 ||
strcmp(symp, ___STRING(_C_LABEL(proc_trampoline))) == 0) {
strcmp(symp, ___STRING(_C_LABEL(proc_trampoline))) == 0 ||
strcmp(symp, "Lmapped_start") == 0) {
pc = fp = SH5_KSEG0_BASE;
break;
}
@ -276,7 +278,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
* The previous PC and FP are available from the
* 'struct trapframe' saved on the stack.
*/
struct trapframe *tf = (struct trapframe *)fp;
struct trapframe *tf = (struct trapframe *)(intptr_t)fp;
pc = (db_addr_t) tf->tf_state.sf_spc & ~1;
fp = (db_addr_t) tf->tf_caller.r14;
cur_intrframe = &tf->tf_ifr;
@ -300,7 +302,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
* and FP are available from the 'struct intrframe'
* saved on the stack.
*/
struct intrframe *tf = (struct intrframe *)fp;
struct intrframe *tf = (struct intrframe *)(intptr_t)fp;
pc = (db_addr_t) tf->if_state.sf_spc & ~1;
fp = (db_addr_t) tf->if_caller.r14;
cur_intrframe = tf;
@ -370,8 +372,9 @@ find_prologue(db_addr_t addr)
char *symp;
addr &= ~3;
#if 0
again:
#endif
symp = NULL;
sym = db_search_symbol(addr, DB_STGY_PROC, &diff);
if (sym == NULL)
@ -383,6 +386,7 @@ again:
if (symp == NULL)
return (0);
#if 0
/*
* Compensate for the <handy breakpoint location after LWP "wakes">
* symbol in ltsleep(), which screws up our search for the function's
@ -392,7 +396,7 @@ again:
addr -= 4;
goto again;
}
#endif
return (addr - diff);
}
@ -444,7 +448,7 @@ prev_frame(db_addr_t curfp, db_addr_t curpc,
/*
* Fetch an opcode from the prologue.
*/
op = *((opcode_t *)prologue);
op = *((opcode_t *)(intptr_t)prologue);
if ((op & OP_ADDI_R15_n_R15_M) == OP_ADDI_R15_n_R15) {
/*