Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp287010lqh; Mon, 6 May 2024 21:13:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVezsw84o/xRiiZAQ06nIgxeLf/wbgPUbZUMMBsaIwmOjqypkC4R9BkSN2idMR0RewJul6fnqNvKpX7PlqKWKvLKbgqG/Lcf8DXoPBx1g== X-Google-Smtp-Source: AGHT+IH2CuvutrKCYcn8zrcAY+yoA3LWs6HLuX9dp+sQbpZyZ3XmxfcpXM2w4JZ6cREZFV27G7KR X-Received: by 2002:a05:6358:3110:b0:18f:81e1:dc33 with SMTP id c16-20020a056358311000b0018f81e1dc33mr17568941rwe.2.1715055227681; Mon, 06 May 2024 21:13:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715055227; cv=pass; d=google.com; s=arc-20160816; b=QdhXwEd/1UxDdUTVzpyXCec6NcxV581R2X2XMp7pVJFYAHsYuAMcQeXCm8IA20mrzP Be1UHEXsGaPgDNOS8r6ZD8G7/UVS3beR5DEQctN+IG8/YidZDJOSXKFoRM7X6LnDnFQv 9CTN3szkpxRaBqyZSFCjU/e1itBRVQEVykO10sQCJCCiy79sJIpFdpRhW9F28aVZXSMf CiDbUm7dNpFqNeKRlFRVCxq57lXa6wgZAfc3WW6w3PEXEUJEWoVcvdUD3rdIjGKLFRA1 iBRt8J71vMBg8Kv1eiq8rBSsDfqaAV23yfazOXmu+I6vmqT7vFMGwgQEln0lVPXm7JOZ IwSA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=rMgYeb2Ag/s5IBxniFpMwcdQ8gTuFmZn8aOXoZ4yVpI=; fh=hyuVp9Oha2tDvtTgvqWs4SbegtByEqnlyHtQxda/lgg=; b=uUspEJCpwxiqXD3Di4MX3jCv/Q5w+dA+gJ48dlCA3ab9e6yb4z0ltBpe6dRrpXnEBS FneXR2F7WE4v4OgeKXHJ9dvfzDwceTdjCRU2U1unOhjqxxjzK3Ry8/PbK02Fdqi0MCq3 PjgDVDXNFFXDn0juyo54uSCE+EWEUBRAT/1NV+ZlfC0Y89moW0q7ByuT5NUv0Ir1CN0n jiYBqsqBudyyduNtGT6qjpDSCCMFNE9pva9OMZDcEFYG5OQlSe29tgxQaeqwQbwYUc1n hlRgFH2WDIXQ6K/o+P3ewpML7BF8wmw+Z2wwDUD5bGG+GD0xET3C6zfsOHX/N887Ma8Y RPPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aKvjkxGR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-170637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170637-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p24-20020a637418000000b0061ec0552c0csi7071544pgc.703.2024.05.06.21.13.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 21:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aKvjkxGR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-170637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170637-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 7331E284FCB for ; Tue, 7 May 2024 04:13:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9300C4F214; Tue, 7 May 2024 04:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aKvjkxGR" 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 B72E8A93C; Tue, 7 May 2024 04:13:40 +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=1715055220; cv=none; b=cvSfamZGRUi5PCu1chdkzRr1mt61pT8K/f53R++AKch0FWJ5kw396omWgmwv82A3th/aLgCIinczYYReEXpDpLQ3b5RTQn85oNE1rMCedle0LFQXe4/goIla8dQKfitJbpj2pSo74QCm7DxAOfyI0RUuPe+AT1t1A3Ki8lMOsqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715055220; c=relaxed/simple; bh=dN7X54J93eDiO9uLDsvJZ+5zjtYlYn/Su5NC4HEspTY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N2FPuZePUIha9YiQ5T1fcebUMN3sUHRUpvHjy6oyxb53tssbeV4qZdcDnsQNKkMcls+zVYWIAdlf6oim4/aXKL8Puj9zWxXEQF+lHnoFitaNLrOAteWCuiL3eH9+FjpTrT8BktahkMa7S2TIRNi47+3oJVBYqe1S3DvGf9jjEKc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aKvjkxGR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8D8FC2BBFC; Tue, 7 May 2024 04:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715055220; bh=dN7X54J93eDiO9uLDsvJZ+5zjtYlYn/Su5NC4HEspTY=; h=From:To:Cc:Subject:Date:From; b=aKvjkxGR1+4drcXwiFonJt7HTraV5UAJscPVqV7kT3M6KhyuBSvhVmG7HS40FUX79 ielvzYYMD013TCwFzdLYy1gByxP8Tm+dhvuwAoxZOCAhAiSrVKXE/2a/7IpHODeO9j JIbzsH6WGmpnFbKjx7jXQPsk87g2uvzXJt6e6tNE14KdN++9csC8R1Phzl1vRrCtuy 6e4CcxdsRW6WPgHH1/YZMH0IZ400KJfOk/RI7hGPePdyi2ADonOm0IcFmLjlG54HiU HnTu/suD+AbWV1sccl8wMbZBXVWvgTc/KwB8x9oIWjVAUPZlRn8QsZZSxIbCtmqojY SceIaTOBUZwBQ== From: Namhyung Kim To: Arnaldo Carvalho de Melo , Ian Rogers , Kan Liang Cc: Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Masami Hiramatsu Subject: [PATCH] perf dwarf-aux: Print array type name with "[]" Date: Mon, 6 May 2024 21:13:38 -0700 Message-ID: <20240507041338.2081775-1-namhyung@kernel.org> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) 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