summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_examine.c
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-06-25 15:59:24 +0000
committertmm <tmm@FreeBSD.org>2002-06-25 15:59:24 +0000
commitb6591e77a03a2acf50546d7c67b6f901f8bb8917 (patch)
tree4d6977f3a048ee8e56ea149de36b759c69d81766 /sys/ddb/db_examine.c
parente17570ea7d6e727fc62d68f48173e24f2babbb46 (diff)
downloadFreeBSD-src-b6591e77a03a2acf50546d7c67b6f901f8bb8917.zip
FreeBSD-src-b6591e77a03a2acf50546d7c67b6f901f8bb8917.tar.gz
Don't assume that pointers are 4 bytes or sizeof(int) in size. This fixes
the indirection operator ('*') and address examination ('x/a') on big-endian platoforms for which the above is not true, as well as on little-endian platforms if the cut-off bits are not 0.
Diffstat (limited to 'sys/ddb/db_examine.c')
-rw-r--r--sys/ddb/db_examine.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c
index dd1cadd..377316a 100644
--- a/sys/ddb/db_examine.c
+++ b/sys/ddb/db_examine.c
@@ -83,26 +83,22 @@ db_examine(addr, fmt, count)
while (--count >= 0) {
fp = fmt;
size = 4;
- width = 16;
while ((c = *fp++) != 0) {
switch (c) {
case 'b':
size = 1;
- width = 4;
break;
case 'h':
size = 2;
- width = 8;
break;
case 'l':
size = 4;
- width = 16;
break;
case 'g':
size = 8;
- width = 32;
break;
case 'a': /* address */
+ size = sizeof(void *);
/* always forces a new line */
if (db_print_position() != 0)
db_printf("\n");
@@ -118,6 +114,7 @@ db_examine(addr, fmt, count)
db_prev = addr;
}
+ width = size * 4;
switch (c) {
case 'r': /* signed, current radix */
value = db_get_value(addr, size, TRUE);
OpenPOWER on IntegriCloud