Subject: kern/32359: DDB: BKPT_SET: API change request: patch attached.
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <cherry@mahiti.org>
List: netbsd-bugs
Date: 12/22/2005 10:25:01
>Number: 32359
>Category: kern
>Synopsis: DDB: BKPT_SET: API change request: patch attached.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Dec 22 10:25:00 +0000 2005
>Originator: Cherry G. Mathew
>Release: -current
>Organization:
Mahiti
>Environment:
>Description:
Hi,
Currently, breakpoint instruction insertion functions use pass by value. This makes things difficult for Itanium's VLIW instruction set.
1) A VLIW word is twice the machine size and not the same, as is implied by current code.
2) Re-assembling the VLIW on the fly by using machine word size snapshots of the 'slots' requires the code to have access to the current address, because the 'slots' are not naturally aligned, and the alignment shifts depend on the slot number, which in turn depends on the breakpoint address given.
Solution for 2) is implemented for Itanium, but interferes with other ports, therefore the request. Patch below makes the change for other ports.
I have _not_ tested this on anything other than Itanium.
Thanks,
Cherry.
Index: arch/alpha/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/alpha/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/alpha/include/db_machdep.h 28 Jun 2005 17:09:04 -0000 1.1.1.1
+++ arch/alpha/include/db_machdep.h 22 Dec 2005 09:51:33 -0000
@@ -50,7 +50,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x00000080 /* breakpoint instruction */
#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define FIXUP_PC_AFTER_BREAK(regs) \
((regs)->tf_regs[FRAME_PC] -= BKPT_SIZE)
Index: arch/amd64/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/amd64/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/amd64/include/db_machdep.h 28 Jun 2005 17:09:12 -0000 1.1.1.1
+++ arch/amd64/include/db_machdep.h 22 Dec 2005 09:55:20 -0000
@@ -60,7 +60,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0xcc /* breakpoint instruction */
#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_rip -= BKPT_SIZE)
Index: arch/arm/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/arm/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/arm/include/db_machdep.h 28 Jun 2005 17:09:30 -0000 1.1.1.1
+++ arch/arm/include/db_machdep.h 22 Dec 2005 09:56:03 -0000
@@ -60,7 +60,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST (KERNEL_BREAKPOINT) /* breakpoint instruction */
#define BKPT_SIZE (INSN_SIZE) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
/*#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_pc -= BKPT_SIZE)*/
Index: arch/hppa/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/hppa/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/hppa/include/db_machdep.h 28 Jun 2005 17:09:41 -0000 1.1.1.1
+++ arch/hppa/include/db_machdep.h 22 Dec 2005 09:56:20 -0000
@@ -63,7 +63,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x00010000 /* break 0,8 */
#define BKPT_SIZE sizeof(int)
-#define BKPT_SET(inst) BKPT_INST
+#define BKPT_SET(inst,addr) BKPT_INST
#define IS_BREAKPOINT_TRAP(type, code) (type != T_RECOVERY)
#define IS_WATCHPOINT_TRAP(type, code) 0
Index: arch/i386/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/i386/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/i386/include/db_machdep.h 28 Jun 2005 17:09:42 -0000 1.1.1.1
+++ arch/i386/include/db_machdep.h 22 Dec 2005 09:56:38 -0000
@@ -58,7 +58,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0xcc /* breakpoint instruction */
#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_eip -= BKPT_SIZE)
Index: arch/m68k/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/m68k/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/m68k/include/db_machdep.h 28 Jun 2005 17:09:47 -0000 1.1.1.1
+++ arch/m68k/include/db_machdep.h 22 Dec 2005 09:57:04 -0000
@@ -56,7 +56,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x4e4f /* breakpoint instruction */
#define BKPT_SIZE (2) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_pc -= BKPT_SIZE)
Index: arch/mips/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/mips/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/mips/include/db_machdep.h 28 Jun 2005 17:09:49 -0000 1.1.1.1
+++ arch/mips/include/db_machdep.h 22 Dec 2005 09:57:23 -0000
@@ -66,7 +66,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x0001000D
#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */
Index: arch/pc532/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/pc532/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/pc532/include/db_machdep.h 28 Jun 2005 17:09:56 -0000 1.1.1.1
+++ arch/pc532/include/db_machdep.h 22 Dec 2005 09:57:45 -0000
@@ -66,7 +66,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0xf2 /* breakpoint instruction */
#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define db_clear_single_step(regs) ((regs)->tf_regs.r_psr &= ~PSL_T)
#define db_set_single_step(regs) ((regs)->tf_regs.r_psr |= PSL_T)
Index: arch/pdp10/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/pdp10/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/pdp10/include/db_machdep.h 28 Jun 2005 17:09:57 -0000 1.1.1.1
+++ arch/pdp10/include/db_machdep.h 22 Dec 2005 09:58:03 -0000
@@ -50,7 +50,7 @@
#define BKPT_INST 0041000000000 /* MUUO */
#define BKPT_SIZE 4 /* bytes */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define IS_BREAKPOINT_TRAP(type, code) (1) /* XXX */
Index: arch/powerpc/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/powerpc/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/powerpc/include/db_machdep.h 28 Jun 2005 17:09:58 -0000 1.1.1.1
+++ arch/powerpc/include/db_machdep.h 22 Dec 2005 09:58:22 -0000
@@ -69,7 +69,7 @@
#define BKPT_ASM "trap" /* should match BKPT_INST */
#define BKPT_INST 0x7fe00008 /* breakpoint instruction */
#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#ifndef PPC_IBM4XX
#define SR_SINGLESTEP 0x400
Index: arch/sh3/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/sh3/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/sh3/include/db_machdep.h 28 Jun 2005 17:10:00 -0000 1.1.1.1
+++ arch/sh3/include/db_machdep.h 22 Dec 2005 09:58:38 -0000
@@ -49,7 +49,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0xc3c3 /* breakpoint instruction */
#define BKPT_SIZE 2 /* size of breakpoint inst */
-#define BKPT_SET(inst) BKPT_INST
+#define BKPT_SET(inst,addr) BKPT_INST
#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_spc -= BKPT_SIZE)
Index: arch/sh5/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/sh5/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/sh5/include/db_machdep.h 28 Jun 2005 17:10:00 -0000 1.1.1.1
+++ arch/sh5/include/db_machdep.h 22 Dec 2005 09:59:06 -0000
@@ -52,7 +52,7 @@
#define BKPT_ADDR(addr) ((addr) & ~3) /* ditch the instruction type bits */
#define BKPT_INST 0x6ff5fff0 /* breakpoint instruction (BRK) */
#define BKPT_SIZE 4 /* size of breakpoint inst */
-#define BKPT_SET(inst) BKPT_INST
+#define BKPT_SET(inst,addr) BKPT_INST
#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK)
#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX (msaitoh) */
Index: arch/sparc/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/sparc/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/sparc/include/db_machdep.h 28 Jun 2005 17:10:27 -0000 1.1.1.1
+++ arch/sparc/include/db_machdep.h 22 Dec 2005 09:59:24 -0000
@@ -68,7 +68,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x91d02001 /* breakpoint instruction */
#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define IS_BREAKPOINT_TRAP(type, code) \
((type) == T_BREAKPOINT || (type) == T_KGDB_EXEC)
Index: arch/sparc64/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/sparc64/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/sparc64/include/db_machdep.h 28 Jun 2005 17:10:28 -0000 1.1.1.1
+++ arch/sparc64/include/db_machdep.h 22 Dec 2005 09:59:40 -0000
@@ -79,7 +79,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x91d02001 /* breakpoint instruction */
#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define IS_BREAKPOINT_TRAP(type, code) \
((type) == T_BREAKPOINT || (type) == T_KGDB_EXEC)
Index: arch/vax/include/db_machdep.h
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/arch/vax/include/db_machdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 db_machdep.h
--- arch/vax/include/db_machdep.h 28 Jun 2005 17:10:30 -0000 1.1.1.1
+++ arch/vax/include/db_machdep.h 22 Dec 2005 10:00:06 -0000
@@ -51,7 +51,7 @@
#define BKPT_ADDR(addr) (addr) /* breakpoint address */
#define BKPT_INST 0x03 /* breakpoint instruction */
#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
+#define BKPT_SET(inst,addr) (BKPT_INST)
#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->pc -= BKPT_SIZE)
Index: ddb/db_break.c
===================================================================
RCS file: /p/ia64src/cvsroot/src/sys/ddb/db_break.c,v
retrieving revision 1.2
diff -u -r1.2 db_break.c
--- ddb/db_break.c 22 Dec 2005 06:13:29 -0000 1.2
+++ ddb/db_break.c 22 Dec 2005 09:41:38 -0000
@@ -172,7 +172,7 @@
bkpt->bkpt_inst = db_get_value(bkpt->address,
BKPT_SIZE, FALSE);
db_put_value(bkpt->address,
- BKPT_SIZE, BKPT_SET(bkpt->bkpt_inst));
+ BKPT_SIZE, BKPT_SET(bkpt->bkpt_inst, bkpt->address));
}
db_breakpoints_inserted = TRUE;
}
>How-To-Repeat:
>Fix: