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.
This commit is contained in:
cgd 1996-02-20 23:56:16 +00:00
parent e98dc62664
commit c0cdc0cf04

View File

@ -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;
}