diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-15 17:10:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-03-15 17:10:23 +0000 |
commit | 620a4f2c78fdbd33bf9b1e40f2b0ac81e84abeda (patch) | |
tree | 6b5dfb9e1f26017884d16e2ad711dcda3ddbb1d0 | |
parent | b550624e3aaf045504c970f073b30a2660690a6a (diff) |
Disable x/q functionnality on 32bit platforms, because the examination code
is not supposed to work on values larger than db_expr_t.
-rw-r--r-- | share/man/man4/ddb.4 | 4 | ||||
-rw-r--r-- | sys/ddb/db_access.c | 12 | ||||
-rw-r--r-- | sys/ddb/db_examine.c | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 28598799f30..ab95f8ac2a9 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ddb.4,v 1.48 2006/11/28 18:56:17 uwe Exp $ +.\" $OpenBSD: ddb.4,v 1.49 2007/03/15 17:10:20 miod Exp $ .\" $NetBSD: ddb.4,v 1.5 1994/11/30 16:22:09 jtc Exp $ .\" .\" Mach Operating System @@ -216,7 +216,7 @@ look at by half words (16 bits) .It Cm /l look at by long words (32 bits) (default) .It Cm /q -look at by long longs (64 bits) +look at by long longs (64 bits) (only available on 64-bit platforms) .It Cm /a print the location being displayed .It Cm /A diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index 3a7c487438a..ade4914f48c 100644 --- a/sys/ddb/db_access.c +++ b/sys/ddb/db_access.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_access.c,v 1.9 2006/03/13 06:23:20 jsg Exp $ */ +/* $OpenBSD: db_access.c,v 1.10 2007/03/15 17:10:22 miod Exp $ */ /* $NetBSD: db_access.c,v 1.8 1994/10/09 08:37:35 mycroft Exp $ */ /* @@ -51,6 +51,11 @@ db_get_value(db_addr_t addr, size_t size, boolean_t is_signed) db_expr_t value, extend; int i; +#ifdef DIAGNOSTIC + if (size > sizeof data) + size = sizeof data; +#endif + db_read_bytes(addr, size, data); value = 0; @@ -73,6 +78,11 @@ db_put_value(db_addr_t addr, size_t size, db_expr_t value) char data[sizeof(db_expr_t)]; int i; +#ifdef DIAGNOSTIC + if (size > sizeof data) + size = sizeof data; +#endif + #if BYTE_ORDER == LITTLE_ENDIAN for (i = 0; i < size; i++) #else /* BYTE_ORDER == BIG_ENDIAN */ diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index eab8e64adbb..10f8913ccfc 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_examine.c,v 1.12 2006/03/13 06:23:20 jsg Exp $ */ +/* $OpenBSD: db_examine.c,v 1.13 2007/03/15 17:10:22 miod Exp $ */ /* $NetBSD: db_examine.c,v 1.11 1996/03/30 22:30:07 christos Exp $ */ /* @@ -101,10 +101,12 @@ db_examine(db_addr_t addr, char *fmt, int count) size = 4; width = 12; break; +#ifdef __LP64__ case 'q': /* quad-word */ size = 8; width = 20; break; +#endif case 'a': /* address */ db_printf("= 0x%lx\n", (long)addr); break; |