From patchwork Tue Nov 20 04:19:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1000266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42zXYr6g27z9s4s for ; Tue, 20 Nov 2018 15:20:32 +1100 (AEDT) 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="lPs0UTpv"; 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 42zXYq64rkzF3Tf for ; Tue, 20 Nov 2018 15:20:31 +1100 (AEDT) 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="lPs0UTpv"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42zXYJ0Z0pzF3Qx for ; Tue, 20 Nov 2018 15:20:04 +1100 (AEDT) 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="lPs0UTpv"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42zXYH559xz9s8r; Tue, 20 Nov 2018 15:20:03 +1100 (AEDT) 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=1542687603; bh=+CVW9jCDktCOBwI2ukeaHjiJTJdDbMklAglLRVBK4wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPs0UTpvsjxhOC3uEd0+ZHQqLi99F9XIWTHRmCL1DbnNsEmPtIAMPZgpiH1/osfLy bZQIgf63M45wNtbkr32UDdyblc0cGNNfC+l3Cn47TMU5/rZpQEumRzaOGDCfUYPmYm Er/BWav3EUx1FpKn8G4VwDvGZPYrcPKw8ksROWmOLhbiplSnpd0Py03zCgGheVU213 Pd5fcv9eLFiuHPTZSLmxBAY+Iny9pwKV4BA/JcFz43n5TNAtQilDcULtOvRMl5pQkv H2W6MEGsXE6B6WwcWCSkdcc3RuDURlnU9SgvsBsEJWjfEwQNLVy/74fODU8zb585ni oF/tHBtGBYOcg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 20 Nov 2018 15:19:51 +1100 Message-Id: <20181120041953.402413-8-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181120041953.402413-1-amitay@ozlabs.org> References: <20181120041953.402413-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 7/9] main: Convert htm commands to path based targeting X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- src/htm.c | 57 +++++++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/src/htm.c b/src/htm.c index 10e35ae..b0e25a3 100644 --- a/src/htm.c +++ b/src/htm.c @@ -37,6 +37,7 @@ #include #include "main.h" +#include "path.h" #define HTM_ENUM_TO_STRING(e) ((e == HTM_NEST) ? "nhtm" : "chtm") @@ -78,10 +79,7 @@ static int run_start(enum htm_type type) struct pdbg_target *target; int rc = 0; - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); + for_each_path_target_class(HTM_ENUM_TO_STRING(type), target) { if (target_is_disabled(target)) continue; @@ -102,10 +100,7 @@ static int run_stop(enum htm_type type) struct pdbg_target *target; int rc = 0; - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); + for_each_path_target_class(HTM_ENUM_TO_STRING(type), target) { if (target_is_disabled(target)) continue; @@ -126,10 +121,7 @@ static int run_status(enum htm_type type) struct pdbg_target *target; int rc = 0; - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); + for_each_path_target_class(HTM_ENUM_TO_STRING(type), target) { if (target_is_disabled(target)) continue; @@ -151,10 +143,7 @@ static int run_dump(enum htm_type type) char *filename; int rc = 0; - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); + for_each_path_target_class(HTM_ENUM_TO_STRING(type), target) { if (target_is_disabled(target)) continue; @@ -182,10 +171,7 @@ static int run_record(enum htm_type type) char *filename; int rc = 0; - pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { - if (!target_selected(target)) - continue; - pdbg_target_probe(target); + for_each_path_target_class(HTM_ENUM_TO_STRING(type), target) { if (target_is_disabled(target)) continue; @@ -283,16 +269,14 @@ int run_htm(int optind, int argc, char *argv[]) } if (type == HTM_CORE) { - pdbg_for_each_class_target("core", target) { - if (target_selected(target)) { - if (!core_target) { - core_target = target; - } else { - fprintf(stderr, "It doesn't make sense to core trace on" - " multiple cores at once.\n"); - fprintf(stderr, "What you probably want is -p 0 -c x\n"); - return 0; - } + for_each_path_target_class("core", target) { + if (!core_target) { + core_target = target; + } else { + fprintf(stderr, "It doesn't make sense to core trace on" + " multiple cores at once.\n"); + fprintf(stderr, "What you probably want is -p 0 -c x\n"); + return 0; } } @@ -315,19 +299,18 @@ int run_htm(int optind, int argc, char *argv[]) /* Select the correct chtm target */ pdbg_for_each_child_target(core_target, target) { if (!strcmp(pdbg_target_class_name(target), "chtm")) { - target_select(target); + assert(path_target_add(target)); pdbg_target_probe(target); } } } if (type == HTM_NEST) { - pdbg_for_each_class_target("pib", target) { - if (!target_selected(target)) - continue; - - pdbg_for_each_target("nhtm", target, nhtm) - target_select(nhtm); + for_each_path_target_class("pib", target) { + pdbg_for_each_target("nhtm", target, nhtm) { + assert(path_target_add(nhtm)); + pdbg_target_probe(nhtm); + } } }