From b6591e77a03a2acf50546d7c67b6f901f8bb8917 Mon Sep 17 00:00:00 2001 From: tmm Date: Tue, 25 Jun 2002 15:59:24 +0000 Subject: 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. --- sys/ddb/db_examine.c | 7 ++----- sys/ddb/db_expr.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'sys') 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); diff --git a/sys/ddb/db_expr.c b/sys/ddb/db_expr.c index 850121b..eb627e7 100644 --- a/sys/ddb/db_expr.c +++ b/sys/ddb/db_expr.c @@ -119,7 +119,7 @@ db_unary(valuep) db_error("Syntax error\n"); /*NOTREACHED*/ } - *valuep = db_get_value((db_addr_t)*valuep, sizeof(int), FALSE); + *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *), FALSE); return (TRUE); } db_unread_token(t); -- cgit v1.1