Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp189617lqo; Tue, 7 May 2024 17:19:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKyPiT8fhYOViRpFDAB9jw3n9mEYiqtFk16f3mFYpj7l0ypIhqYTs6NslcccQcrnq+F+xMZpQzbszBI7DyN8TicvD/UkZjySfwHzzD9A== X-Google-Smtp-Source: AGHT+IH2607qGb1PiXIhq9lzLtigC9F7fGzp2rKWmuteCjROJcjshXaBNIu0vbmi+Pf93hntfgUM X-Received: by 2002:a05:6358:2249:b0:192:2e43:9285 with SMTP id e5c5f4694b2df-192d2c2a422mr148081755d.13.1715127596117; Tue, 07 May 2024 17:19:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715127596; cv=pass; d=google.com; s=arc-20160816; b=ZIHCuOvrBxuFw7gSxlzarIeqcTgb5jyb+5czGZeNLLCz51s7WwAz4vnFvrcSjyRz7d nqv+xt/5iYCpxP7ThwUedlrfbngDQJBKu3OoxQEQiUTwQ/g4cWgH3nqRN8uJCU/kiplj 4ZyoYdqkL0vRQDEqqmtwmWyyCr+eb1XFFCN5v3NrCiSIQF8qKZnkuNQC4Ezt8OeTm2UB i39kl2lO8fZSlhcmWpenMysuiay/SlfqMnGeGfF/a+dePBm3ObtkCVg7RKISiAxxhfO/ qVQetco2PkUG0QChRQ69QpHBeW9uPzsmNOS4W7DCjKfhW414GYlUOmhsPFFV9tBMiq5q hMrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=KXkoWhCD2kKMKjJKKu0zYw+fwFHNi/T7Cu2AqKa6OZQ=; fh=oHLhpxxJj2FqQhZLDWcqFWwxkpgBAyCp4xTj/Lc7SS8=; b=tCRzIi22Qvo9Aa7W8hh9z5erBIMPNKcUqiySoyB3dWxc4SvMGKu8wKckjXvVKwKtAO F+PmK7MNTxZjdnTxYzYSue9kzZ56l+oEwYQHEF5TPh+DHx3AE3Jsdn97nglCaBKLljj0 hMUCBljP/EeTdTSvl1sPTCcnbAELJuJwoZwHjCtOi/V+/DozfJNGfX47WqesXw2yowPo W/GMNEKMwOm5aeX4EpAXeQXR5s7rBku0FFMYOK3Y3Z1Vwsnk4niQ3lZcfH9Cktz3oO6g V1M/Pn08fZqBKDPL4yos3FZaeyR3kTLE5sUMqZFiUFv5Gp8TQt2YRw+iOArlVGLrX4h9 iEjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ROawISFc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172538-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u31-20020a63471f000000b0062b95d219e9si2532573pga.432.2024.05.07.17.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 17:19:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172538-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ROawISFc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172538-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172538-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 91EFF28A086 for ; Wed, 8 May 2024 00:09:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C08913848A; Tue, 7 May 2024 23:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ROawISFc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 749131A2C05; Tue, 7 May 2024 23:57:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715126276; cv=none; b=eBmNx3rIAmWjLXAaxwKooylMs2jPrXG/9qU+R91s6qh99R5EFGe0qZqY0KJeThO3Z8DRmFhkhp0Xse+ATgilHnl/fEOyUJnSvlHCSa5S9aDJLVHcT618JhsM91odD4xfF6BF34MxtdIPHP0ZORZ74H3QHh7jfANe7bcR7A5b2gI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715126276; c=relaxed/simple; bh=u4y6bm9T98w2O0nxzxQv6wXthaTemHVgGjKBpl1iA6w=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=O5ErDjH9+SO/W1x1YeOfgJpCBtEBmeq2Wf0G5HbvhKEkrDrSPl7RQETadFWLvSEkGsFJFTHYu/1bZ/8tRRblvCt/1aYYg369w1+ffH7UqKphlWWivZBGhdB6HBgNLOlo3kJqfIbcFVqDneMJ8/uVKxYaWt0OuWMiGpgQfEJe3/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ROawISFc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A345C2BBFC; Tue, 7 May 2024 23:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715126276; bh=u4y6bm9T98w2O0nxzxQv6wXthaTemHVgGjKBpl1iA6w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ROawISFcDVWDM6CB2v8B6Kf6rcPEdS68hDm1K4EQ6Ao2C8WGuvVDCBcBVlpx3nrP6 CDdaUpYETWj26vVqx0ZJiB4x3jsXQ8kKi/9omhioCmpopL/kIiaYLVWMQkbVtlOBmA esDvDYxxkvVAS7mFjKqZlNlpQnEfabauWgEXeFtlpk6b0KXKQKAVPv0TUjL7cHgDVL Rc3evIbaVvvsW/zBvgNcT+2SCSgfaVDZoBVnnyEc8MF+C6HAwitVONt/rVKvw2vPG3 Cws/IbXzJLhpzarrTYtCe3/snSPrm5+xtBbnGZ7PzmJrXEvWy4FTVJZgz977eSobT0 HLQH1UpJFbr1A== Date: Wed, 8 May 2024 08:57:51 +0900 From: Masami Hiramatsu (Google) To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Masami Hiramatsu Subject: Re: [PATCH] perf dwarf-aux: Print array type name with "[]" Message-Id: <20240508085751.a1a5dbd31e1fa7d4e80cdd85@kernel.org> In-Reply-To: <20240507041338.2081775-1-namhyung@kernel.org> References: <20240507041338.2081775-1-namhyung@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 6 May 2024 21:13:38 -0700 Namhyung Kim wrote: > It's confusing both pointers and arrays are printed as *. Let's print > array types with [] so that we can identify them easily. Although it's > interchangable, sometimes it can cause confusion with size like in the > below example. > > Note that it is not the same with C syntax where it goes to the variable > names, but we want to have it in the type names (like in Go language). > > Before: > mov [20] 0x68(reg5) -> reg0 type='struct page**' size=0x80 (die:0x4e61d32) > > After: > mov [20] 0x68(reg5) -> reg0 type='struct page*[]' size=0x80 (die:0x4e61d32) > Good improvement! Acked-by: Masami Hiramatsu (Google) Thank you! > Cc: Masami Hiramatsu > Signed-off-by: Namhyung Kim > --- > tools/perf/util/dwarf-aux.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c > index c0a492e65388..ec988f294497 100644 > --- a/tools/perf/util/dwarf-aux.c > +++ b/tools/perf/util/dwarf-aux.c > @@ -1110,8 +1110,10 @@ int die_get_typename_from_type(Dwarf_Die *type_die, struct strbuf *buf) > const char *tmp = ""; > > tag = dwarf_tag(type_die); > - if (tag == DW_TAG_array_type || tag == DW_TAG_pointer_type) > + if (tag == DW_TAG_pointer_type) > tmp = "*"; > + else if (tag == DW_TAG_array_type) > + tmp = "[]"; > else if (tag == DW_TAG_subroutine_type) { > /* Function pointer */ > return strbuf_add(buf, "(function_type)", 15); > -- > 2.45.0.rc1.225.g2a3ae87e7f-goog > -- Masami Hiramatsu (Google)