Message ID | 20181002060430.3344784-9-amitay@ozlabs.org |
---|---|
State | Superseded |
Headers | show |
Series | Device tree path base targeting | expand |
Looks good Amitay! One question though: > @@ -718,16 +713,14 @@ static int probe(void) > { > struct pdbg_target *target; > > - pdbg_for_each_class_target("pib", target) { > - if (!target_selected(target)) > - continue; > + for_each_path_target(target, false) { > + pdbg_target_probe(target); > + } > > + pdbg_for_each_class_target("pib", target) { > print_target(target, 0); Is there a reason you didn't use the new functions/macros added to do the above? Ie. use "true" and call for_each_path_target_class("pib", target, true) instead and eliminate one of the loops? - Alistair > } > > - printf("\nNote that only selected targets will be shown above. If none are > shown\n" - "try adding '-a' to select all targets\n"); > - > return 1; > } > OPTCMD_DEFINE_CMD(probe, probe); > diff --git a/tests/test_selection.sh b/tests/test_selection.sh > index 2b23ec1..8909796 100755 > --- a/tests/test_selection.sh > +++ b/tests/test_selection.sh > @@ -13,10 +13,9 @@ do_skip () > fi > } > > -test_result 0 <<EOF > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > +test_result 1 <<EOF > +No valid targets found or specified. Try adding -p/-c/-t options to specify > a target. +Alternatively run 'pdbg -a probe' to get a list of all valid > targets EOF > > do_skip > @@ -128,9 +127,6 @@ p7: Fake PIB > c3: Fake Core > t0: Fake Thread > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -151,9 +147,6 @@ p0: Fake PIB > c3: Fake Core > t0: Fake Thread > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -193,9 +186,6 @@ p7: Fake PIB > c0: Fake Core > t0: Fake Thread > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -275,9 +265,6 @@ p7: Fake PIB > t0: Fake Thread > c3: Fake Core > t0: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -289,9 +276,6 @@ p0: Fake PIB > c2: Fake Core > t0: Fake Thread > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -302,9 +286,6 @@ test_result 0 <<EOF > p0: Fake PIB > c2: Fake Core > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -328,9 +309,6 @@ p6: Fake PIB > c0: Fake Core > t0: Fake Thread > > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > - > EOF > > do_skip > @@ -339,9 +317,6 @@ test_run pdbg -b fake -p1-3,5,5-6 -c0 -t0 probe > > test_result 0 <<EOF > p0: Fake PIB > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -391,9 +366,6 @@ test_run pdbg -b fake -t0 -p0 probe > test_result 0 <<EOF > p0: Fake PIB > c0: Fake Core > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -404,9 +376,6 @@ test_result 0 <<EOF > p0: Fake PIB > c0: Fake Core > t0: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -434,9 +403,6 @@ p7: Fake PIB > t0: Fake Thread > c3: Fake Core > t0: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip > @@ -464,9 +430,6 @@ p7: Fake PIB > t1: Fake Thread > c3: Fake Core > t1: Fake Thread > - > -Note that only selected targets will be shown above. If none are shown > -try adding '-a' to select all targets > EOF > > do_skip
diff --git a/src/main.c b/src/main.c index feb24fa..95796b9 100644 --- a/src/main.c +++ b/src/main.c @@ -677,8 +677,6 @@ void print_target(struct pdbg_target *target, int level) struct pdbg_target *next; enum pdbg_target_status status; - pdbg_target_probe(target); - /* Does this target actually exist? */ status = pdbg_target_status(target); if (status != PDBG_TARGET_ENABLED) @@ -707,9 +705,6 @@ 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); } } @@ -718,16 +713,14 @@ static int probe(void) { struct pdbg_target *target; - pdbg_for_each_class_target("pib", target) { - if (!target_selected(target)) - continue; + for_each_path_target(target, false) { + pdbg_target_probe(target); + } + pdbg_for_each_class_target("pib", target) { 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"); - return 1; } OPTCMD_DEFINE_CMD(probe, probe); diff --git a/tests/test_selection.sh b/tests/test_selection.sh index 2b23ec1..8909796 100755 --- a/tests/test_selection.sh +++ b/tests/test_selection.sh @@ -13,10 +13,9 @@ do_skip () fi } -test_result 0 <<EOF - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets +test_result 1 <<EOF +No valid targets found or specified. Try adding -p/-c/-t options to specify a target. +Alternatively run 'pdbg -a probe' to get a list of all valid targets EOF do_skip @@ -128,9 +127,6 @@ p7: Fake PIB c3: Fake Core t0: Fake Thread t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -151,9 +147,6 @@ p0: Fake PIB c3: Fake Core t0: Fake Thread t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -193,9 +186,6 @@ p7: Fake PIB c0: Fake Core t0: Fake Thread t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -275,9 +265,6 @@ p7: Fake PIB t0: Fake Thread c3: Fake Core t0: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -289,9 +276,6 @@ p0: Fake PIB c2: Fake Core t0: Fake Thread t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -302,9 +286,6 @@ test_result 0 <<EOF p0: Fake PIB c2: Fake Core t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -328,9 +309,6 @@ p6: Fake PIB c0: Fake Core t0: Fake Thread -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets - EOF do_skip @@ -339,9 +317,6 @@ test_run pdbg -b fake -p1-3,5,5-6 -c0 -t0 probe test_result 0 <<EOF p0: Fake PIB - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -391,9 +366,6 @@ test_run pdbg -b fake -t0 -p0 probe test_result 0 <<EOF p0: Fake PIB c0: Fake Core - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -404,9 +376,6 @@ test_result 0 <<EOF p0: Fake PIB c0: Fake Core t0: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -434,9 +403,6 @@ p7: Fake PIB t0: Fake Thread c3: Fake Core t0: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip @@ -464,9 +430,6 @@ p7: Fake PIB t1: Fake Thread c3: Fake Core t1: Fake Thread - -Note that only selected targets will be shown above. If none are shown -try adding '-a' to select all targets EOF do_skip
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/main.c | 15 ++++---------- tests/test_selection.sh | 43 +++-------------------------------------- 2 files changed, 7 insertions(+), 51 deletions(-)