Keep the first and last snapshot of variables.

So we can compare our reconstruction of the variable state.

Test: treehugger
Change-Id: I9c1995f8969dcf95256aa7c05a01d0431e36caa2
diff --git a/core/dumpconfig.mk b/core/dumpconfig.mk
index cb7fbcb..dd3ef43 100644
--- a/core/dumpconfig.mk
+++ b/core/dumpconfig.mk
@@ -79,11 +79,19 @@
 #   $(2): Root nodes to import
 #   $(3): All variable names
 #   $(4): Single-value variables
-define dump-product-var-names
+#   $(5): Makefile being processed
+define dump-phase-start
 $(eval $(file >> $(DUMPCONFIG_FILE),phase,$(strip $(1)),$(strip $(2)))) \
 $(foreach var,$(3), \
     $(eval $(file >> $(DUMPCONFIG_FILE),var,$(if $(filter $(4),$(var)),single,list),$(var))) \
-)
+) \
+$(call dump-config-vals,$(strip $(5)),initial)
+endef
+
+# Args:
+#   $(1): Makefile being processed
+define dump-phase-end
+$(call dump-config-vals,$(strip $(1)),final)
 endef
 
 define dump-debug
@@ -110,7 +118,7 @@
 
 # Args:
 #   $(1): Makefile that was included
-#   $(2): block (before,import,after)
+#   $(2): block (before,import,after,initial,final)
 define dump-config-vals
 $(foreach var,$(filter-out $(DUMPCONFIG_SKIP_VARS),$(.KATI_SYMBOLS)),\
     $(eval $(file >> $(DUMPCONFIG_FILE),val,$(call escape-for-csv,$(1)),$(2),$(call escape-for-csv,$(var)),$(call escape-for-csv,$($(var))),$(call escape-for-csv,$(KATI_variable_location $(var))))) \
diff --git a/core/node_fns.mk b/core/node_fns.mk
index 878a4dd..8d20160 100644
--- a/core/node_fns.mk
+++ b/core/node_fns.mk
@@ -254,13 +254,13 @@
 #       of the default list semantics
 #
 define import-nodes
+$(call dump-phase-start,$(1),$(2),$(3),$(4),build/make/core/node_fns.mk) \
 $(if \
   $(foreach _in,$(2), \
     $(eval _node_import_context := _nic.$(1).[[$(_in)]]) \
     $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack \
                 should be empty here: $(_include_stack))),) \
     $(eval _include_stack := ) \
-    $(call dump-product-var-names,$(1),$(2),$(3),$(4)) \
     $(call _import-nodes-inner,$(_node_import_context),$(_in),$(3),$(4)) \
     $(call move-var-list,$(_node_import_context).$(_in),$(1).$(_in),$(3)) \
     $(eval _node_import_context :=) \
@@ -268,5 +268,6 @@
     $(if $(_include_stack),$(eval $(error ASSERTION FAILED: _include_stack \
                 should be empty here: $(_include_stack))),) \
    ) \
-,)
+,) \
+$(call dump-phase-end,build/make/core/node_fns.mk)
 endef