Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src New modifiers for the "write" command: /BHL. They act like /...
details: https://anonhg.NetBSD.org/src/rev/c37a75e0bbc1
branches: trunk
changeset: 751330:c37a75e0bbc1
user: phx <phx%NetBSD.org@localhost>
date: Sun Jan 31 21:52:23 2010 +0000
description:
New modifiers for the "write" command: /BHL. They act like /bhl but do not
read the old value from memory before writing.
diffstat:
share/man/man4/ddb.4 | 15 ++++++++++++---
sys/ddb/db_write_cmd.c | 21 ++++++++++++++-------
2 files changed, 26 insertions(+), 10 deletions(-)
diffs (96 lines):
diff -r 1a678e4b324d -r c37a75e0bbc1 share/man/man4/ddb.4
--- a/share/man/man4/ddb.4 Sun Jan 31 21:36:38 2010 +0000
+++ b/share/man/man4/ddb.4 Sun Jan 31 21:52:23 2010 +0000
@@ -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.
diff -r 1a678e4b324d -r c37a75e0bbc1 sys/ddb/db_write_cmd.c
--- a/sys/ddb/db_write_cmd.c Sun Jan 31 21:36:38 2010 +0000
+++ b/sys/ddb/db_write_cmd.c Sun Jan 31 21:52:23 2010 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index