Subject: bin/15842: tweak to make(1) debugging output
To: None <gnats-bugs@gnats.netbsd.org>
From: Lloyd Parkes <lloyd@must-have-coffee.gen.nz>
List: netbsd-bugs
Date: 03/09/2002 17:16:52
>Number: 15842
>Category: bin
>Synopsis: minor improvement to debugging of '.undef' in make(1)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 08 20:17:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Lloyd Parkes
>Release: NetBSD 1.5ZA
>Organization:
Must Have Coffee
>Environment:
System: NetBSD ophidian.must-have-coffee.gen.nz 1.5ZA NetBSD 1.5ZA (GENERIC) #4: Sat Feb 23 11:24:21 NZDT 2002 lloyd@ophidian.must-have-coffee.gen.nz:/vol/NetBSD/build/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
When trying to work out what is being to a variable (e.g.
USE_NEW_TOOLCHAIN), the make debug flags 'cv' are very handy.
Unfortunately make only tells you when it attempts to '.undef' a
variable. It doesn't always succeed and this patch logs this
>How-To-Repeat:
Try and find out why 'make USE_NEW_TOOLCHAIN=no' doesn't work.
>Fix:
Apply the following patch.
Index: var.c
===================================================================
RCS file: /vol/NetBSD/cvs-src/basesrc/usr.bin/make/var.c,v
retrieving revision 1.68
diff -c -r1.68 var.c
*** var.c 2002/02/06 16:26:12 1.68
--- var.c 2002/03/09 04:14:49
***************
*** 402,408 ****
Hash_Entry *ln;
if (DEBUG(VAR)) {
! printf("%s:delete %s\n", ctxt->name, name);
}
ln = Hash_FindEntry(&ctxt->context, name);
if (ln != NULL) {
--- 402,408 ----
Hash_Entry *ln;
if (DEBUG(VAR)) {
! printf("%s:delete %s ", ctxt->name, name);
}
ln = Hash_FindEntry(&ctxt->context, name);
if (ln != NULL) {
***************
*** 410,419 ****
v = (Var *)Hash_GetValue(ln);
if (v->name != ln->name)
! free(v->name);
Hash_DeleteEntry(&ctxt->context, ln);
Buf_Destroy(v->val, TRUE);
free((Address) v);
}
}
--- 410,427 ----
v = (Var *)Hash_GetValue(ln);
if (v->name != ln->name)
! free(v->name);
Hash_DeleteEntry(&ctxt->context, ln);
Buf_Destroy(v->val, TRUE);
free((Address) v);
+ if (DEBUG(VAR)) {
+ printf("\n");
+ }
+ }
+ else {
+ if (DEBUG(VAR)) {
+ printf(" (failed)\n", ctxt->name, name);
+ }
}
}
>Release-Note:
>Audit-Trail:
>Unformatted:
Version 1.67 of basesrc/usr.bin/make/var.c