diff mbox series

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

Message ID 20180809051927.243483-6-amitay@ozlabs.org
State Accepted
Headers show
Series Fix target selection (yet again) | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Amitay Isaacs Aug. 9, 2018, 5:19 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 src/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

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");