Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): add more debugging for searching trans...



details:   https://anonhg.NetBSD.org/src/rev/e9074f0a30ce
branches:  trunk
changeset: 946298:e9074f0a30ce
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 22 21:34:34 2020 +0000

description:
make(1): add more debugging for searching transformation rules

diffstat:

 usr.bin/make/make.h                         |   5 ++-
 usr.bin/make/suff.c                         |  43 +++++++++++++++++-----------
 usr.bin/make/unit-tests/suff-incomplete.exp |   6 ++--
 usr.bin/make/unit-tests/suff-lookup.exp     |   8 ++--
 usr.bin/make/unit-tests/suff-rebuild.exp    |   8 ++--
 5 files changed, 40 insertions(+), 30 deletions(-)

diffs (240 lines):

diff -r 9cf19f464741 -r e9074f0a30ce usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sun Nov 22 20:36:17 2020 +0000
+++ b/usr.bin/make/make.h       Sun Nov 22 21:34:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.213 2020/11/22 10:48:11 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.214 2020/11/22 21:34:34 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -279,7 +279,8 @@
      * this node will be saved on the .END node instead, to be executed at
      * the very end. */
     OP_SAVE_CMDS       = 1 << 25,
-    /* Already processed by Suff_FindDeps */
+    /* Already processed by Suff_FindDeps, to find dependencies from suffix
+     * transformation rules. */
     OP_DEPS_FOUND      = 1 << 24,
     /* Node found while expanding .ALLSRC */
     OP_MARK            = 1 << 23,
diff -r 9cf19f464741 -r e9074f0a30ce usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Nov 22 20:36:17 2020 +0000
+++ b/usr.bin/make/suff.c       Sun Nov 22 21:34:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -893,8 +893,10 @@
 {
     CandidateListNode *ln;
 
-    for (ln = list->first; ln != NULL; ln = ln->next)
-       debug_printf(" %p", ln->datum);
+    for (ln = list->first; ln != NULL; ln = ln->next) {
+       Candidate *cand = ln->datum;
+       debug_printf(" %p:%s", cand, cand->file);
+    }
     debug_printf("\n");
 }
 #endif
@@ -929,8 +931,8 @@
 
 #ifdef DEBUG_SRC
     Lst_Append(targ->childrenList, cand);
-    debug_printf("%s add suff %p candidate %p to list %p:",
-                debug_tag, targ, cand, list);
+    debug_printf("%s add suff %p:%s candidate %p:%s to list %p:",
+                debug_tag, targ, targ->file, cand, cand->file, list);
     CandidateList_PrintAddrs(list);
 #endif
 }
@@ -988,8 +990,8 @@
                src->parent->numChildren--;
            }
 #ifdef DEBUG_SRC
-           debug_printf("free: list %p src %p children %d\n",
-                        srcs, src, src->numChildren);
+           debug_printf("free: list %p src %p:%s children %d\n",
+                        srcs, src, src->file, src->numChildren);
            Lst_Free(src->childrenList);
 #endif
            Lst_Remove(srcs, ln);
@@ -998,8 +1000,8 @@
        }
 #ifdef DEBUG_SRC
        else {
-           debug_printf("keep: list %p src %p children %d:",
-                        srcs, src, src->numChildren);
+           debug_printf("keep: list %p src %p:%s children %d:",
+                        srcs, src, src->file, src->numChildren);
            CandidateList_PrintAddrs(src->childrenList);
        }
 #endif
@@ -1026,7 +1028,8 @@
         */
        if (Targ_FindNode(src->file) != NULL) {
 #ifdef DEBUG_SRC
-           debug_printf("remove from list %p src %p\n", srcs, src);
+           debug_printf("remove from list %p src %p:%s\n",
+                        srcs, src, src->file);
 #endif
            retsrc = src;
            break;
@@ -1037,7 +1040,8 @@
            if (file != NULL) {
                retsrc = src;
 #ifdef DEBUG_SRC
-               debug_printf("remove from list %p src %p\n", srcs, src);
+               debug_printf("remove from list %p src %p:%s\n",
+                            srcs, src, src->file);
 #endif
                free(file);
                break;
@@ -1119,7 +1123,8 @@
     ret = Candidate_New(bmake_strdup(sgn->name), targ->prefix, suff, targ, sgn);
     targ->numChildren++;
 #ifdef DEBUG_SRC
-    debug_printf("3 add targ %p ret %p\n", targ, ret);
+    debug_printf("3 add targ %p:%s ret %p:%s\n",
+                targ, targ->file, ret, ret->file);
     Lst_Append(targ->childrenList, ret);
 #endif
     Lst_Append(slst, ret);
@@ -1741,6 +1746,10 @@
     const char *name = gn->name;
     size_t nameLen = strlen(name);
 
+#ifdef DEBUG_SRC
+    DEBUG1(SUFF, "FindDepsRegular \"%s\"\n", gn->name);
+#endif
+
     /*
      * Begin at the beginning...
      */
@@ -1918,9 +1927,9 @@
 
 /* Find implicit sources for the target.
  *
- * Nodes are added to the graph below the passed-in node. The nodes are
- * marked to have their IMPSRC variable filled in. The PREFIX variable is set
- * for the given node and all its implied children.
+ * Nodes are added to the graph as children of the passed-in node. The nodes
+ * are marked to have their IMPSRC variable filled in. The PREFIX variable
+ * is set for the given node and all its implied children.
  *
  * The path found by this target is the shortest path in the transformation
  * graph, which may pass through non-existent targets, to an existing target.
@@ -1957,7 +1966,7 @@
     Var_Set(TARGET, GNode_Path(gn), gn);
     Var_Set(PREFIX, gn->name, gn);
 
-    SUFF_DEBUG1("SuffFindDeps (%s)\n", gn->name);
+    SUFF_DEBUG1("SuffFindDeps \"%s\"\n", gn->name);
 
     if (gn->type & OP_ARCHV)
        FindDepsArchive(gn, slst);
diff -r 9cf19f464741 -r e9074f0a30ce usr.bin/make/unit-tests/suff-incomplete.exp
--- a/usr.bin/make/unit-tests/suff-incomplete.exp       Sun Nov 22 20:36:17 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-incomplete.exp       Sun Nov 22 21:34:34 2020 +0000
@@ -26,16 +26,16 @@
 ParseReadLine (24): '  : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.'
 transformation .DEFAULT complete
 Wildcard expanding "all"...
-SuffFindDeps (all)
+SuffFindDeps "all"
        No known suffix on all. Using .NULL suffix
 adding suffix rules
 Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
-SuffFindDeps (suff-incomplete.c)
+SuffFindDeps "suff-incomplete.c"
        trying suff-incomplete.a...not there
 Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
 : Making suff-incomplete.c from suff-incomplete.c all  by default.
 Wildcard expanding "all"...
-SuffFindDeps (.END)
+SuffFindDeps ".END"
        No known suffix on .END. Using .NULL suffix
 adding suffix rules
 Wildcard expanding ".END"...
diff -r 9cf19f464741 -r e9074f0a30ce usr.bin/make/unit-tests/suff-lookup.exp
--- a/usr.bin/make/unit-tests/suff-lookup.exp   Sun Nov 22 20:36:17 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.exp   Sun Nov 22 21:34:34 2020 +0000
@@ -42,11 +42,11 @@
 inserting ".dead-end" (6) at end of list
 inserting ".short" (4) at end of list
 Wildcard expanding "all"...
-SuffFindDeps (all)
+SuffFindDeps "all"
        No known suffix on all. Using .NULL suffix
 adding suffix rules
 Wildcard expanding "suff-lookup.cc"...suffix is ".cc"...
-SuffFindDeps (suff-lookup.cc)
+SuffFindDeps "suff-lookup.cc"
        trying suff-lookup.ccc...not there
        trying suff-lookup.c...not there
        trying suff-lookup.short...not there
@@ -57,14 +57,14 @@
 suffix is ".ccc"...
 suffix is ".c"...
 suffix is ".sho"...
-SuffFindDeps (suff-lookup.sho)
+SuffFindDeps "suff-lookup.sho"
 suffix is ".sho"...
 : 'Making suff-lookup.sho out of nothing.'
 : 'Making suff-lookup.c from suff-lookup.sho.'
 : 'Making suff-lookup.ccc from suff-lookup.c.'
 : 'Making suff-lookup.cc from suff-lookup.ccc.'
 Wildcard expanding "all"...
-SuffFindDeps (.END)
+SuffFindDeps ".END"
        No known suffix on .END. Using .NULL suffix
 adding suffix rules
 Wildcard expanding ".END"...
diff -r 9cf19f464741 -r e9074f0a30ce usr.bin/make/unit-tests/suff-rebuild.exp
--- a/usr.bin/make/unit-tests/suff-rebuild.exp  Sun Nov 22 20:36:17 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-rebuild.exp  Sun Nov 22 21:34:34 2020 +0000
@@ -35,14 +35,14 @@
 ParseDoDependency(.SUFFIXES: .c .b .a)
 Adding ".END" to all targets.
 Wildcard expanding "all"...
-SuffFindDeps (all)
+SuffFindDeps "all"
        No known suffix on all. Using .NULL suffix
 adding suffix rules
        trying all.c...not there
        trying all.b...not there
        trying all.a...not there
 Wildcard expanding "suff-rebuild-example"...
-SuffFindDeps (suff-rebuild-example)
+SuffFindDeps "suff-rebuild-example"
        No known suffix on suff-rebuild-example. Using .NULL suffix
 adding suffix rules
        trying suff-rebuild-example.c...not there
@@ -56,14 +56,14 @@
 suffix is ".c"...
 suffix is ".b"...
 suffix is ".a"...
-SuffFindDeps (suff-rebuild-example.a)
+SuffFindDeps "suff-rebuild-example.a"
 suffix is ".a"...
 : Making suff-rebuild-example.a out of nothing.
 : Making suff-rebuild-example.b from suff-rebuild-example.a.
 : Making suff-rebuild-example.c from suff-rebuild-example.b.
 : Making suff-rebuild-example from suff-rebuild-example.c.
 Wildcard expanding "all"...
-SuffFindDeps (.END)
+SuffFindDeps ".END"
        No known suffix on .END. Using .NULL suffix
 adding suffix rules
        trying .END.c...not there



Home | Main Index | Thread Index | Old Index