Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb changes of r1.39 was incomplete. only "examin/m" cou...
details: https://anonhg.NetBSD.org/src/rev/a7b96cbd2add
branches: trunk
changeset: 454251:a7b96cbd2add
user: ryo <ryo%NetBSD.org@localhost>
date: Thu Sep 12 09:20:23 2019 +0000
description:
changes of r1.39 was incomplete. only "examin/m" could handle 'q'.
added support 'r','x','z','d','u', and 'o' with 'q' modifier on 32bit arch.
diffstat:
sys/ddb/db_access.c | 24 ++++++++++++++++++++++--
sys/ddb/db_access.h | 3 ++-
sys/ddb/db_examine.c | 34 +++++++++++++++++-----------------
3 files changed, 41 insertions(+), 20 deletions(-)
diffs (173 lines):
diff -r 195f0d8bb739 -r a7b96cbd2add sys/ddb/db_access.c
--- a/sys/ddb/db_access.c Thu Sep 12 09:05:28 2019 +0000
+++ b/sys/ddb/db_access.c Thu Sep 12 09:20:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_access.c,v 1.24 2019/08/23 14:48:50 kamil Exp $ */
+/* $NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $ */
/*
* Mach Operating System
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.24 2019/08/23 14:48:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $");
#if defined(_KERNEL_OPT)
#include "opt_kgdb.h"
@@ -82,6 +82,26 @@
return (value);
}
+quad_t
+db_get_qvalue(db_addr_t addr, size_t size, bool is_signed)
+{
+ uint64_t data;
+
+ if (sizeof(db_expr_t) >= sizeof(quad_t) || size <= sizeof(db_expr_t)) {
+ if (is_signed)
+ return db_get_value(addr, size, true);
+ return (uint32_t)db_get_value(addr, size, false);
+ }
+
+ if (size != sizeof(data)) {
+ db_error("unnsupported size\n");
+ /*NOTREACHED*/
+ }
+
+ db_read_bytes(addr, sizeof(data), (char *)&data);
+ return data;
+}
+
void
db_put_value(db_addr_t addr, size_t size, db_expr_t value)
{
diff -r 195f0d8bb739 -r a7b96cbd2add sys/ddb/db_access.h
--- a/sys/ddb/db_access.h Thu Sep 12 09:05:28 2019 +0000
+++ b/sys/ddb/db_access.h Thu Sep 12 09:20:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_access.h,v 1.13 2009/03/07 22:02:17 ad Exp $ */
+/* $NetBSD: db_access.h,v 1.14 2019/09/12 09:20:23 ryo Exp $ */
/*
* Mach Operating System
@@ -33,6 +33,7 @@
* Data access functions for debugger.
*/
db_expr_t db_get_value(db_addr_t, size_t, bool);
+quad_t db_get_qvalue(db_addr_t, size_t, bool);
void db_put_value(db_addr_t, size_t, db_expr_t);
void db_read_bytes(db_addr_t, size_t, char *);
diff -r 195f0d8bb739 -r a7b96cbd2add sys/ddb/db_examine.c
--- a/sys/ddb/db_examine.c Thu Sep 12 09:05:28 2019 +0000
+++ b/sys/ddb/db_examine.c Thu Sep 12 09:20:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $ */
+/* $NetBSD: db_examine.c,v 1.40 2019/09/12 09:20:23 ryo Exp $ */
/*
* Mach Operating System
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.40 2019/09/12 09:20:23 ryo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -70,7 +70,7 @@
db_examine(db_addr_t addr, char *fmt, int count)
{
int i, c;
- db_expr_t value;
+ quad_t value;
int size;
int width;
int bytes;
@@ -103,7 +103,7 @@
break;
case 'q': /* quad-word */
size = 8;
- width = 16;
+ width = 24;
break;
case 'L': /* implementation maximum */
size = sizeof value;
@@ -114,27 +114,27 @@
break;
case 'p':
size = sizeof(void *);
- value = db_get_value(addr, size, true);
+ value = db_get_value(addr, size, false);
addr += size;
db_printf("= 0x%lx ", (long)value);
db_printsym((db_addr_t)value, DB_STGY_ANY, db_printf);
db_printf("\n");
break;
case 'r': /* signed, current radix */
- value = db_get_value(addr, size, true);
+ value = db_get_qvalue(addr, size, true);
addr += size;
db_format_radix(tbuf, 24, value, false);
db_printf("%-*s", width, tbuf);
break;
case 'x': /* unsigned hex */
- value = db_get_value(addr, size, false);
+ value = db_get_qvalue(addr, size, false);
addr += size;
- db_printf("%-*" DDB_EXPR_FMT "x", width, value);
+ db_printf("%-*" PRIx64, width, value);
break;
case 'm': /* hex dump */
/*
* Print off in chunks of size. Try to print 16
- * bytes at a time into 4 columns. This
+ * bytes at a time into 16/size columns. This
* loops modify's count extra times in order
* to get the nicely formatted lines.
*/
@@ -152,7 +152,7 @@
1, false);
#endif
db_printf(
- "%02" DDB_EXPR_FMT "x",
+ "%02" PRIx64,
value);
bytes++;
if (!(bytes % size))
@@ -174,25 +174,25 @@
db_printf("\n");
break;
case 'z': /* signed hex */
- value = db_get_value(addr, size, true);
+ value = db_get_qvalue(addr, size, true);
addr += size;
db_format_hex(tbuf, 24, value, false);
db_printf("%-*s", width, tbuf);
break;
case 'd': /* signed decimal */
- value = db_get_value(addr, size, true);
+ value = db_get_qvalue(addr, size, true);
addr += size;
- db_printf("%-*" DDB_EXPR_FMT "d", width, value);
+ db_printf("%-*" PRId64, width, value);
break;
case 'u': /* unsigned decimal */
- value = db_get_value(addr, size, false);
+ value = db_get_qvalue(addr, size, false);
addr += size;
- db_printf("%-*" DDB_EXPR_FMT "u", width, value);
+ db_printf("%-*" PRIu64, width, value);
break;
case 'o': /* unsigned octal */
- value = db_get_value(addr, size, false);
+ value = db_get_qvalue(addr, size, false);
addr += size;
- db_printf("%-*" DDB_EXPR_FMT "o", width, value);
+ db_printf("%-*" PRIo64, width, value);
break;
case 'c': /* character */
value = db_get_value(addr, 1, false);
Home |
Main Index |
Thread Index |
Old Index