From nobody Tue Feb 10 05:17:07 2026 Received: from mail-yx1-f43.google.com (mail-yx1-f43.google.com [74.125.224.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 494A52D593C for ; Tue, 27 Jan 2026 02:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769479602; cv=none; b=Vw/DwODwGXhobQW1ScbBT6OIN9ipL10iVqT9ncUyQ0cq1hmWYlNuN4YlZcxtGE4mpVPLdIiDRUDWBcIK0GfenBndSbJU8Lkzpuq/Q89ZjIcQB+NzWkQrRsBn0Cz/yr5vsgIyq2Hedhy1MMtErs/h2PvarYfZvKPy7KBSitQ3IvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769479602; c=relaxed/simple; bh=SoMJumxPd4W2dw4TJ+tdyjRZta389m1tZHjTj6591bo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VBGL9l/75Qz5RHATJAHvs497jqCRwjMNAPXTKHDw1UQC2kEm39At3BjrKXi+byLqJm6D0usVY0pFrrpEcgJsVqVjn51m6tlQ+D/lOeVk8c3PS8irQvfCrBiCMkg8WblzoNjTqYqcVmgyzxtleDJlUclQ2WDDVIzv/QCS2pTvFXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ncsu.edu; spf=pass smtp.mailfrom=ncsu.edu; dkim=pass (2048-bit key) header.d=ncsu.edu header.i=@ncsu.edu header.b=fMk6hrak; arc=none smtp.client-ip=74.125.224.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ncsu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ncsu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ncsu.edu header.i=@ncsu.edu header.b="fMk6hrak" Received: by mail-yx1-f43.google.com with SMTP id 956f58d0204a3-644715aad1aso5925591d50.0 for ; Mon, 26 Jan 2026 18:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncsu.edu; s=google; t=1769479599; x=1770084399; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jEdogTaDxzCQioYG14x9ed5a66Fqemos79HWYjw4Gx4=; b=fMk6hrakbIcwGZiZY5V0M2CHU3dYcC5DHHrYURBVxSGVxSh89KRf+6ABCNEPnde13K GdOkd4/o3jMbx56Tx1lmexWtuRU90RNFs/wMro5cATpzrJJOWLkGU4zGEWpNtbY2jeFj 7APjH+KLA1GR7VEwzPw6JE5FOTzJhfhjbfKzYCRbH97FCzq6WZ+Yc9J+svgY647PgXPv IPtI+lvocB5jJcHTXmHnRWigffcE+8qKK5S4TP4hwVcLjaLo04Ox62YIFN2CG8R5AGZF yibJvX6a9nUccFLm3QsR+IEPGQZ9lK9GPqpU/GdfkRyv0ptxWu7Hp0IfUmjAYFla6Do9 LgOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769479599; x=1770084399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jEdogTaDxzCQioYG14x9ed5a66Fqemos79HWYjw4Gx4=; b=GGHOCEfj4dooQThBjcQiD0t7AlaHi+9nVPNCMrRJPDpkA4cJ3yY/0AhBY9R1Xdy2IC ojpMZstqKkQotRHCC6yPfKhKKP4RMFInF+6a6yO6kV4/nsoMhXwbJtl6YQ4JvHiwTkvj aKWdLPO5CgJ7/TgwDJOLlprYiL8tIFflEE1zeKlHUMSIgYkSgnkzSkl4bQ1Jm47z0fBv Z3n7ar7bckokXwv657vXMwpuIVl3+mroYbRDrbE0IsAAszWg2Qo0IqT22OwbmlHanSbH GQbRYjqaOztamOLPgOdZPmfjIWQYR9EipOnhLFwgbOFz8obhX+tE0TbTQbAIep2cK39q NDqQ== X-Forwarded-Encrypted: i=1; AJvYcCWSotSe0hXlV2jF+u3KAoNjHBRI/gkkLE+rDg6WD77Jd3htNRZ2S7x42zF9qh+3N42BF1Pug3noUw+FUE0=@vger.kernel.org X-Gm-Message-State: AOJu0YxtzqIcBX14Z7+xiCEaEULAovJuFEodSA/p1iAHsCG7qfmTApkv 48YCT4bTKIT244Q61b31qn7mZ6vydXSRmWkW0AEQJQDMVAGP+hH4kDz6tEVkSrWJmQ== X-Gm-Gg: AZuq6aIJZv7r3VGzyfBOz7dUaBkovtMNZwFKECEJ2ADmySbdH9s2zjxPzoJy7KL2dcz hNl8lRAP7YWAU/IVV5TUlMueQ+oXXeYuyNn+SQAHyZ8hx1XwJbRtvpXms009v6FZMZ3bib2hgQB +OzgRBCiNNMp9FokcTfkgaGWNgbIkEh4MTsmcLFmLjkcSyIwt/THrD7Ki1W9CfszJhyPVS6CHoM bwWcb1R2JCZut3Ny2OGpjsmRg8/QCkXEmsUckEJY/DrcMN1Z0rL86l03oC0O2exzNKdu9tYDer2 DPzlpJtQdxBHL4BLwPyjhXobk5f1mYkPwMndOIJAp7Fvxfw/bOPtHAPKIhqYK+BPne6thiKLjS7 N4CYwFx2iRqugYepkRbXWvwdvLhwau49SkuMQwoOOfv62iSV0E/M2y0OPyeFXUAnqgIuxsPuI1p kWkkgbGsstWg== X-Received: by 2002:a05:690e:c4a:b0:63f:b2b3:8c2d with SMTP id 956f58d0204a3-6498faa7712mr48308d50.17.1769479599102; Mon, 26 Jan 2026 18:06:39 -0800 (PST) Received: from um773-cachyos ([2600:1700:cc0:94af:eca6:9ff9:6f3c:5de9]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-6496855d65esm4217415d50.12.2026.01.26.18.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 18:06:38 -0800 (PST) From: Zecheng Li To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Zecheng Li , xliuprof@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 05/11] perf dwarf-aux: Handle array types in die_get_member_type Date: Mon, 26 Jan 2026 21:04:58 -0500 Message-ID: <20260127020617.2804780-6-zli94@ncsu.edu> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127020617.2804780-1-zli94@ncsu.edu> References: <20260127020617.2804780-1-zli94@ncsu.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a struct member is an array type, die_get_member_type() would stop iterating since array types weren't handled in the loop. This caused accesses to array elements within structs to not resolve properly. Add array type handling by resolving the array to its element type and calculating the offset within an element using modulo arithmetic This improves type annotation coverage for struct members that are arrays. Signed-off-by: Zecheng Li --- tools/perf/util/dwarf-aux.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index ce816aefa95b..ee72b7a4a65d 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c @@ -2125,13 +2125,28 @@ Dwarf_Die *die_get_member_type(Dwarf_Die *type_die,= int offset, =20 tag =3D dwarf_tag(&mb_type); =20 - if (tag =3D=3D DW_TAG_structure_type || tag =3D=3D DW_TAG_union_type) { + if (tag =3D=3D DW_TAG_structure_type || tag =3D=3D DW_TAG_union_type || + tag =3D=3D DW_TAG_array_type) { Dwarf_Word loc; =20 /* Update offset for the start of the member struct */ if (die_get_data_member_location(member, &loc) =3D=3D 0) offset -=3D loc; } + + /* Handle array types: resolve to the element type by one level */ + if (tag =3D=3D DW_TAG_array_type) { + Dwarf_Word size; + + if (die_get_real_type(&mb_type, &mb_type) =3D=3D NULL) + return NULL; + + if (dwarf_aggregate_size(&mb_type, &size) < 0) + return NULL; + + offset =3D offset % size; + tag =3D dwarf_tag(&mb_type); + } } *die_mem =3D mb_type; return die_mem; --=20 2.52.0