Module Name:    src
Committed By:   ryo
Date:           Thu Mar 11 10:34:34 UTC 2021

Modified Files:
        src/share/man/man4: ddb.4
        src/sys/arch/aarch64/aarch64: db_machdep.c

Log Message:
Numeric modifiers conflict with the syntax interpretation of ddb, so use 'b', 
'w', 'l', 'q' instead.
Also, change load/store('l','s') to 'r','w' like the other arch.

 >db{0}> machine watch/1 hostname
 >Bad modifier

 >db{0}> machine watch/s1 hostname
 >add watchpoint 0 as ffffc00001087848


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/share/man/man4/ddb.4
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/aarch64/aarch64/db_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.198 src/share/man/man4/ddb.4:1.199
--- src/share/man/man4/ddb.4:1.198	Fri Feb 19 08:57:56 2021
+++ src/share/man/man4/ddb.4	Thu Mar 11 10:34:34 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.198 2021/02/19 08:57:56 msaitoh Exp $
+.\"	$NetBSD: ddb.4,v 1.199 2021/03/11 10:34:34 ryo Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd February 19, 2021
+.Dd March 11, 2021
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -1017,6 +1017,8 @@ set (e.g.
 Some of these commands are:
 .Ss AARCH64
 .Bl -tag -width "traptrace" -compact
+.It Ic break
+Set or clear a hardware breakpoint.
 .It Ic cpu
 Switch to another CPU.
 .It Ic cpuinfo
@@ -1035,26 +1037,18 @@ Print system registers.
 Set or clear a hardware watchpoint.
 Pass the address to be watched, or watchpoint number to clear the watchpoint.
 Optional modifiers are
-.Dq l
-for load access,
-.Dq s
-for store access,
-.Dq 1
+.Dq r
+for read access,
+.Dq w
+for write access (default: trap on read or write access),
+.Dq b
 for 8 bit width,
-.Dq 2
+.Dq h
 for 16 bit,
-.Dq 3
-for 24 bit,
-.Dq 4
-for 32 bit,
-.Dq 5
-for 40 bit,
-.Dq 6
-for 48 bit,
-.Dq 7
-for 56 bit,
-.Dq 8
-for 64 bit.
+.Dq l
+for 32 bit or,
+.Dq q
+for 64 bit (default: 32 bit).
 .El
 .Ss ALPHA
 .Bl -tag -width "traptrace" -compact

Index: src/sys/arch/aarch64/aarch64/db_machdep.c
diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.38 src/sys/arch/aarch64/aarch64/db_machdep.c:1.39
--- src/sys/arch/aarch64/aarch64/db_machdep.c:1.38	Thu Mar 11 09:48:40 2021
+++ src/sys/arch/aarch64/aarch64/db_machdep.c	Thu Mar 11 10:34:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $ */
+/* $NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -179,10 +179,11 @@ const struct db_command db_machine_comma
 		DDB_ADD_CMD(
 		    "watch", db_md_watch_cmd, 0,
 		    "set or clear watchpoint",
-		    "[/12345678] [address|#]",
+		    "[/rwbhlq] [address|#]",
 		    "\taddress: watchpoint address to set\n"
-		    "\t#: watchpoint number to remove"
-		    "\t/1..8: size of data\n")
+		    "\t#: watchpoint number to remove\n"
+		    "\t/rw: read or write access\n"
+		    "\t/bhlq: size of access\n")
 	},
 	{
 		DDB_ADD_CMD(
@@ -978,20 +979,22 @@ db_md_watch_cmd(db_expr_t addr, bool hav
 			ch = *modif;
 
 			switch (ch) {
-			case '1':
-			case '2':
-			case '3':
-			case '4':
-			case '5':
-			case '6':
-			case '7':
-			case '8':
-				watchsize = ch - '0';
+			case 'b':
+				watchsize = 1;
+				break;
+			case 'h':
+				watchsize = 2;
 				break;
 			case 'l':
+				watchsize = 4;
+				break;
+			case 'q':
+				watchsize = 8;
+				break;
+			case 'r':
 				accesstype |= WATCHPOINT_ACCESS_LOAD;
 				break;
-			case 's':
+			case 'w':
 				accesstype |= WATCHPOINT_ACCESS_STORE;
 				break;
 			}

Reply via email to