Module Name: src Committed By: phx Date: Sun Jan 31 21:52:24 UTC 2010
Modified Files: src/share/man/man4: ddb.4 src/sys/ddb: db_write_cmd.c Log Message: New modifiers for the "write" command: /BHL. They act like /bhl but do not read the old value from memory before writing. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/share/man/man4/ddb.4 cvs rdiff -u -r1.23 -r1.24 src/sys/ddb/db_write_cmd.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.133 src/share/man/man4/ddb.4:1.134 --- src/share/man/man4/ddb.4:1.133 Fri Jan 29 10:48:45 2010 +++ src/share/man/man4/ddb.4 Sun Jan 31 21:52:23 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: ddb.4,v 1.133 2010/01/29 10:48:45 wiz Exp $ +.\" $NetBSD: ddb.4,v 1.134 2010/01/31 21:52:23 phx Exp $ .\" .\" Copyright (c) 1997 - 2009 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 January 28, 2010 +.Dd January 31, 2010 .Dt DDB 4 .Os .Sh NAME @@ -852,7 +852,7 @@ Watchpoints on user addresses work the best. .It Ic whatis Ar address Describe what an address is. -.It Ic write Ns Oo Cm /bhl Oc Ar address Ar expression Oo Ar expression ... Oc +.It Ic write Ns Oo Cm /bhlBHL Oc Ar address Ar expression Oo Ar expression ... Oc Write the .Ar expression Ns s at succeeding locations. @@ -867,6 +867,15 @@ .Cm /l is used. .Pp +Specifying the modifiers in upper case, +.Cm /B , +.Cm /H , +.Cm /L , +will prevent +.Nm +from reading the memory location first, which is useful for avoiding +side effects when writing to I/O memory regions. +.Pp Warning: since there is no delimiter between .Ar expression Ns s , strange things may occur. Index: src/sys/ddb/db_write_cmd.c diff -u src/sys/ddb/db_write_cmd.c:1.23 src/sys/ddb/db_write_cmd.c:1.24 --- src/sys/ddb/db_write_cmd.c:1.23 Sat Mar 7 22:02:17 2009 +++ src/sys/ddb/db_write_cmd.c Sun Jan 31 21:52:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: db_write_cmd.c,v 1.23 2009/03/07 22:02:17 ad Exp $ */ +/* $NetBSD: db_write_cmd.c,v 1.24 2010/01/31 21:52:23 phx Exp $ */ /* * Mach Operating System @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_write_cmd.c,v 1.23 2009/03/07 22:02:17 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_write_cmd.c,v 1.24 2010/01/31 21:52:23 phx Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -49,11 +49,14 @@ db_expr_t old_value; db_expr_t new_value; int size; - bool wrote_one = false; + bool wrote_one; + bool show_old_val; addr = (db_addr_t) address; + wrote_one = false; + show_old_val = islower((unsigned char)modif[0]); - switch (modif[0]) { + switch (tolower((unsigned char)modif[0])) { case 'b': size = 1; break; @@ -71,10 +74,14 @@ } while (db_expression(&new_value)) { - old_value = db_get_value(addr, size, false); db_printsym(addr, DB_STGY_ANY, db_printf); - db_printf("\t\t%s = ", db_num_to_str(old_value)); - db_printf("%s\n", db_num_to_str(new_value)); + if (show_old_val) { + old_value = db_get_value(addr, size, false); + db_printf("\t\t%s = ", db_num_to_str(old_value)); + db_printf("%s\n", db_num_to_str(new_value)); + } + else + db_printf("\t\t= %s\n", db_num_to_str(new_value)); db_put_value(addr, size, new_value); addr += size;