From nobody Fri Apr 3 06:25:02 2026 Received: from mail-yx1-f52.google.com (mail-yx1-f52.google.com [74.125.224.52]) (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 278883F23CF for ; Mon, 9 Mar 2026 17:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773078961; cv=none; b=mJvGNSrZ7dVfxA1IjFTUaJFfYRAyBmNumOxBY5mRCmBh86CGdZi4HgJdD3OsHY/zH+6+XPEp8bg7Kbc+QUtm9Nzbw+uzaL8l08SLkH7QDgO1CybgCauznpuIk07NhWMOK3FyPPWZ8Ck/c8aEmo83EgIRLzPqd8jZVmoVttI9dyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773078961; c=relaxed/simple; bh=OAU4joyMCvkTz0gfnas3vvrqU9KLdL5ai5pE4aFt60k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dkXwOTbTWc0cUe6WSMz09KKHnzwKbvUHRw93KcI8KADjAYJy8vqfFGOaOWgIDULJcqFtySuBXbDKlJck9i0eBYtexztsXarDrnAh5mFQB+PI+dZsUriVVQ7jiE9WGCV2Ms4iMbox8oaa2SkZjh7zwVVqBT0rTXo0nvW7vw4DJCA= 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=RaLAwFbz; arc=none smtp.client-ip=74.125.224.52 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="RaLAwFbz" Received: by mail-yx1-f52.google.com with SMTP id 956f58d0204a3-64c9f7576d4so8887088d50.0 for ; Mon, 09 Mar 2026 10:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncsu.edu; s=google; t=1773078957; x=1773683757; 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=sSYCnTvgRwKgqJAv6DduOBpprY0x2d8AW9Jn0k87SVE=; b=RaLAwFbzkRcbjJaJXXz6kwuYB4M5qX+FSesZ4AzXwjJXOUw1fAp2COXxpyefz2iW+2 qmnu0QYr+2+riFb10x8X40L/gr3LYE0EbiLBfAziKqaMMB9+4ghOiPUzxL1wxWFIpGv3 HzGQk+NWOAzO3jr2uLev6yOFFbT16hSBXuRMRI6GNhoJI4NqA2FrG1tiOnZ4gzStSzBX nplxlABEBI7rxjn1sZVFXwMCatiIhFuNS4x+x9PXOfYEcyv+IsK25YQgnhqDqSX6eZtu 8zG4rrAl0S9WDngUUMMpHLmNOvTyMesRpIQnoQ9xvr3JOIRyunKB7prylqGMkbVhDBi5 S4DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773078957; x=1773683757; 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=sSYCnTvgRwKgqJAv6DduOBpprY0x2d8AW9Jn0k87SVE=; b=nvme01iRzNJ7ZSZs+t9Ow8sCE963JuU3AroHSpbFJGPUEcUdzIlCYq7k9d3sieIvK0 qBimly1OfFiQcT6NfPoZ0Hv2jlolDmT01B/2/wRvCYXsstSvjoe2M+G2QIlCr9uSfRLa +hw+8KhOu81R/NK+hK+Q2WdrAeqPwcFu5+wDSzGTmSzkNNTuC2MZuck+WBAUa+/h0eQ9 EYhjyiuhRR10Ng+iJb9wbu+7Z7x13Lwws4XPOrENg5J/v5QHVIPu3hCmFypCe3+ah1he 2IUniQmAk66sKv0dcSsFdivjSruJ1ylju6ZJbPjz0beFy15otXcXt7I5HLMQ3P/NZzFx DW9A== X-Forwarded-Encrypted: i=1; AJvYcCUIuvY8BkBF1Gfkv7+uA3CcdZSGxBl4tBV18uGNGTQOncll8B7vy/QreOnRP8k4F2w4g0iv4Rt4DPxH5yY=@vger.kernel.org X-Gm-Message-State: AOJu0Ywrq7wJ2M/79Kh5lhY8A2KHc10CyVNDxpicJbOaKfuJW9bu26D8 Q18kjKblTPjD+Ft1cuFfJ8k083VkFi8ZlMBKnhCPfQbrIG64iHSIIb4QseIst4r3+g== X-Gm-Gg: ATEYQzyLIGi2n6T6e0iNnL8Lmwpme+Xr2KG3JILYFR2rbRr36P2SyqEt6BUClcVFKcc bfBO5LO/rH1vmEDrpCnjKWgmQYD6A9KNF37vG8+FwQNpFJj4eTjudUutcNmEn0Odq5x0hrvFi2P uRkZ5rEgbf6oT21klG25cyq7+7HAWeCFDvwqU3MA1lvjovsw973MtfQFUln7Q/ZEZwi6IGRBOTa 191VTfbNl54wc928A2og7rcfxuxnTw7u6sca9VF7NYFSHb3kPtUWvWL93rcGQsQFFrNK0yI1BvF 0pQ/y50seX6Xl4pxMHBhZ1LAZqoD/J4iQ0XfrDkV/+Xj5LOxvUquMXltS3gqVA5pRqI/vDOHtZL APXqcQSLKZTM4TojcTmiCDU29JjGMxpZKmZbP1vkFqpS+f4YR+gUugA2Fyd1XrbXMlLmAl9X7ov viUaZ2+AFQ2F7Ju3JRTrK3Tg/45uSqaQV4N3Cl4r3OtdRiAY7YaW4nv07V X-Received: by 2002:a05:690e:134a:b0:64a:d1a9:a64 with SMTP id 956f58d0204a3-64d142baacdmr10625010d50.55.1773078956967; Mon, 09 Mar 2026 10:55:56 -0700 (PDT) Received: from um773-cachyos.sd.ncsu.edu ([152.7.255.206]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64d176e70e7sm4992535d50.20.2026.03.09.10.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 10:55:56 -0700 (PDT) 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 v2 05/11] perf dwarf-aux: Handle array types in die_get_member_type Date: Mon, 9 Mar 2026 13:55:18 -0400 Message-ID: <20260309175546.916039-6-zli94@ncsu.edu> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260309175546.916039-1-zli94@ncsu.edu> References: <20260309175546.916039-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 1484aa756826..1feefc329154 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c @@ -2127,13 +2127,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.53.0