summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@ozlabs.org>2018-07-02 14:11:32 +1000
committerAlistair Popple <alistair@popple.id.au>2018-07-12 13:14:00 +1000
commit60d0ab1a23ae02bc4ea361899731d8b710920c99 (patch)
tree92a566e7280ad3968d35be624fcc2e275e75f543
parentceacc6c8c017f914c338918e53de7750ae1bc63d (diff)
downloadpdbg-60d0ab1a23ae02bc4ea361899731d8b710920c99.tar.gz
pdbg-60d0ab1a23ae02bc4ea361899731d8b710920c99.zip
main: Select only the targets specified on cmdline
This fixes the problem of incorrectly selecting threads for following command-line without any thread specification. pdbg -p 0 -c 0 ... Before iterating through [pct]_list, confirm that [pct]_count > 0. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
-rw-r--r--src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 06612fd..ed06dc3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -378,18 +378,27 @@ static bool parse_options(int argc, char *argv[])
return false;
}
+ if (p_count == 0)
+ return true;
+
for (i = 0; i < MAX_PROCESSORS; i++) {
if (p_list[i] == 0)
continue;
processorsel[i] = &chipsel[i][0];
+ if (c_count == 0)
+ continue;
+
for (j = 0; j < MAX_CHIPS; j++) {
if (c_list[j] == 0)
continue;
chipsel[i][j] = &threadsel[i][j][0];
+ if (t_count == 0)
+ continue;
+
for (k = 0; k < MAX_THREADS; k++) {
if (t_list[k] == 0)
continue;
OpenPOWER on IntegriCloud