From patchwork Fri Nov 16 01:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 998659 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 42x0fM1fQ8z9sB5 for ; Fri, 16 Nov 2018 12:15:39 +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="H7yjUl2U"; 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 42x0fL6dBGzF3hK for ; Fri, 16 Nov 2018 12:15:38 +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="H7yjUl2U"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (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 42x0dN379DzF3ff for ; Fri, 16 Nov 2018 12:14:48 +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="H7yjUl2U"; 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 42x0dM6WMWz9sB5; Fri, 16 Nov 2018 12:14:47 +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=1542330888; bh=kxe6f9Hucj9PYH20DfhuLsbQIFtXsJNWSXyhK32YjP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H7yjUl2U1k9vD86U4GGTKJvy3JCWMM9p4fYouSh8wtxV2aVORAnvs6lRwCstoW7CT oHUd41swT8rIFAfUuZlRHNaDqUb2PTm5oKPXOf7H+4woaPfyE2cop4GRiwH3400xs2 RljbVOeSNtzf1VKS2L23cq27S9mwkwHPU1S3mTn4old/YLt/oF74j25oYoA6at9Gxu IUi55uT+CTlC09/XeLaw8eL6in8N4vtvPWvyKfObhwdlgbtLnn1/MgDjglW1x0/FoT 220bGLFPMlCj1xhZjl9dJrWul1J7e7OSftRsomNf7GA5lcBdSQyy5KFpxKvWAiHHeD 0IK08oUSXCGNw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 16 Nov 2018 12:14:27 +1100 Message-Id: <20181116011431.246208-13-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116011431.246208-1-amitay@ozlabs.org> References: <20181116011431.246208-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v4 12/16] main: Update probe output to display device names 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" With capability of selecting any target in the device tree, probe output should display all the nodes with their device tree names. Signed-off-by: Amitay Isaacs --- src/main.c | 27 +- tests/test_selection.sh | 591 +++++++++++++-------------- tests/test_selection2.sh | 838 ++++++++++++++++++++------------------- 3 files changed, 736 insertions(+), 720 deletions(-) diff --git a/src/main.c b/src/main.c index 51e39d9..961d850 100644 --- a/src/main.c +++ b/src/main.c @@ -677,6 +677,7 @@ void print_target(struct pdbg_target *target, int level) int i; struct pdbg_target *next; enum pdbg_target_status status; + char *classname; /* Does this target actually exist? */ status = pdbg_target_status(target); @@ -686,24 +687,14 @@ void print_target(struct pdbg_target *target, int level) for (i = 0; i < level; i++) printf(" "); - if (target) { - char c = 0; - - if (!pdbg_target_class_name(target)) - return; - - if (!strcmp(pdbg_target_class_name(target), "pib")) - c = 'p'; - else if (!strcmp(pdbg_target_class_name(target), "core")) - c = 'c'; - else if (!strcmp(pdbg_target_class_name(target), "thread")) - c = 't'; + classname = pdbg_target_class_name(target); + if (!classname) + return; - if (c) - printf("%c%d: %s\n", c, pdbg_target_index(target), pdbg_target_name(target)); - else - printf("%s\n", pdbg_target_name(target)); - } + printf("%s%d: %s", classname, pdbg_target_index(target), pdbg_target_name(target)); + if (target_selected(target)) + printf(" (*)"); + printf("\n"); pdbg_for_each_child_target(target, next) { print_target(next, level + 1); @@ -714,7 +705,7 @@ static int probe(void) { struct pdbg_target *target; - pdbg_for_each_class_target("pib", target) { + pdbg_for_each_child_target(pdbg_target_root(), target) { print_target(target, 0); } diff --git a/tests/test_selection.sh b/tests/test_selection.sh index 8909796..50db9e4 100755 --- a/tests/test_selection.sh +++ b/tests/test_selection.sh @@ -23,110 +23,111 @@ test_run pdbg -b fake probe test_result 0 <