[Pdbg] [PATCH] main: Select only the targets specified on cmdline

Amitay Isaacs amitay at ozlabs.org
Mon Jul 2 14:11:32 AEST 2018


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 at ozlabs.org>
---
 src/main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main.c b/src/main.c
index 53e1c2b..4956740 100644
--- a/src/main.c
+++ b/src/main.c
@@ -379,18 +379,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;
-- 
2.17.1



More information about the Pdbg mailing list