[Pdbg] [PATCH 5/5] main: Fix print_target to only print selected targets

Amitay Isaacs amitay at ozlabs.org
Thu Aug 9 15:19:27 AEST 2018


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 1ab0cff..b446b5b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -769,6 +769,9 @@ void print_target(struct pdbg_target *target, int level)
 	}
 
 	pdbg_for_each_child_target(target, next) {
+		if (!target_selected(next))
+			continue;
+
 		print_target(next, level + 1);
 	}
 }
@@ -777,8 +780,12 @@ static int probe(void)
 {
 	struct pdbg_target *target;
 
-	pdbg_for_each_class_target("pib", target)
+	pdbg_for_each_class_target("pib", target) {
+		if (!target_selected(target))
+			continue;
+
 		print_target(target, 0);
+	}
 
 	printf("\nNote that only selected targets will be shown above. If none are shown\n"
 			"try adding '-a' to select all targets\n");
-- 
2.17.1



More information about the Pdbg mailing list