[PATCH v2 3/6] dtoc: Add some debugging when copying nodes
Simon Glass
sjg at chromium.org
Sun Jul 23 05:43:54 CEST 2023
Show the operations being performed, when debugging is enabled.
Convert a mistaken 'print' in test_copy_subnodes_from_phandles() while we
are here.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Use a 'done' variable to reduce code duplication
tools/dtoc/fdt.py | 5 +++++
tools/dtoc/test_fdt.py | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 2589be990ae9..f6a9dee0db12 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -249,6 +249,7 @@ class Prop:
"""
if self.dirty:
node = self._node
+ tout.debug(f'sync {node.path}: {self.name}')
fdt_obj = node._fdt._fdt_obj
node_name = fdt_obj.get_name(node._offset)
if node_name and node_name != node.name:
@@ -716,9 +717,13 @@ class Node:
'phandle' property is not copied since this might result in two nodes
with the same phandle, thus making phandle references ambiguous.
"""
+ tout.debug(f'copy to {self.path}: {src.path}')
for name, src_prop in src.props.items():
+ done = False
if name != 'phandle' and name not in self.props:
self.props[name] = Prop(self, None, name, src_prop.bytes)
+ done = True
+ tout.debug(f" {name}{'' if done else ' - ignored'}")
def copy_node(self, src):
"""Copy a node and all its subnodes into this node
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 84dcd8b5caa5..f77e48b54eaf 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -32,6 +32,7 @@ from dtoc.fdt import Type, BytesToValue
import libfdt
from u_boot_pylib import test_util
from u_boot_pylib import tools
+from u_boot_pylib import tout
#pylint: disable=protected-access
@@ -414,7 +415,7 @@ class TestNode(unittest.TestCase):
# Make sure that the phandle for 'over' is not copied
over = dst.FindNode('over')
- print('keys', over.props.keys())
+ tout.debug(f'keys: {over.props.keys()}')
self.assertNotIn('phandle', over.props.keys())
# Check the merged properties, first the base ones in '/dest'
--
2.41.0.487.g6d72f3e995-goog
More information about the U-Boot
mailing list