From c0cdc0cf045e64743616bdccdee52f3f5139f5c6 Mon Sep 17 00:00:00 2001 From: cgd Date: Tue, 20 Feb 1996 23:56:16 +0000 Subject: [PATCH] when printing data modified on the free list: (1) do not cast it to (void *), and (2) print it as 0x%x, rather than %p. This is not perfect (because the data being printed is "int32_t"-sized), but is more correct than printing it as a pointer because the data is _not_ a pointer, it is data to be printed in hex, and on some systems, pointers are wider than the data items being printed, which leads to excess and misleading output. The only 'right' solution to this is to have a printf specifier that prints the fixed-sized types the right way, and that's not really practical. --- sys/kern/kern_malloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 555dc6b0ea38..a41bb2232925 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_malloc.c,v 1.13 1996/02/09 18:59:39 christos Exp $ */ +/* $NetBSD: kern_malloc.c,v 1.14 1996/02/20 23:56:16 cgd Exp $ */ /* * Copyright (c) 1987, 1991, 1993 @@ -223,10 +223,9 @@ malloc(size, type, flags) for (lp = (int32_t *)va; lp < end; lp++) { if (*lp == WEIRD_ADDR) continue; - printf("%s %d of object %p size %d %s %s (%p != %p)\n", + printf("%s %d of object %p size %d %s %s (0x%x != 0x%x)\n", "Data modified on freelist: word", lp - (int32_t *)va, - va, size, "previous type", savedtype, (void *)*lp, - (void *) WEIRD_ADDR); + va, size, "previous type", savedtype, *lp, WEIRD_ADDR); break; }