From patchwork Mon Jul 2 04:11:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 937671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Jv3645ghz9s3q for ; Mon, 2 Jul 2018 14:12:02 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="U2Gx+yLN"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41Jv362RZHzF1D8 for ; Mon, 2 Jul 2018 14:12:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="U2Gx+yLN"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Jv2m2pwDzF1P6 for ; Mon, 2 Jul 2018 14:11:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="U2Gx+yLN"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41Jv2m0wF3z9s29; Mon, 2 Jul 2018 14:11:44 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1530504704; bh=ZAPbMZoVfwfxR30teFUpyqW7RUc5yLwgg28KTywBn7Q=; h=From:To:Cc:Subject:Date:From; b=U2Gx+yLNe88N7J9aA/c18GG3vjA+3zQ/83dqagdRy4PNbv5kwyLu5fyBTYe3xD0Vo FGXkG3EGMkKL0UogPOJdbW6rsxcvS9eAf5aqCxrcZ3LJnO24Lae/504+rjL5yi9mFc Bv+gyeNxA9Z3FMC7JR7GRGwsbo//HAlOSQU8e6IL8t650jFiwOknlexzMAQMUX5ya6 bYDCTFpWUFa99ZNE2br1L3tcJ8GzcW7E8j3xxNUXEJE48yBueQKCR4AniIiYs+0ooh E1yqUZViIA1Mzr7HCnjFZMuxnjnXqWgRCVZ4mNKn0/GFjybeH1TYxiy9o4f2RyoD4k cs5fYhxtOnzYQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Mon, 2 Jul 2018 14:11:32 +1000 Message-Id: <20180702041132.26078-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 Subject: [Pdbg] [PATCH] main: Select only the targets specified on cmdline X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" 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 --- 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;