Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1021559rdf; Sat, 4 Nov 2023 03:52:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQ9wWk3zd16NvMt7ZchVbcT5jUY9wBN2bHMuoiCs4aMw3PPgUxnFcsUgLGP6grvjDCHdY2 X-Received: by 2002:a05:690c:dd5:b0:5a7:bde8:51d5 with SMTP id db21-20020a05690c0dd500b005a7bde851d5mr5893453ywb.32.1699095156243; Sat, 04 Nov 2023 03:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699095156; cv=none; d=google.com; s=arc-20160816; b=DjHfn4ITXkS87+bEuHUBJE8i8ZPgWNsXub82AlRzheur3U5M+H5+htg+sIYZy1xt4g 83ZwGT7A7gXi5YJaxClGzKnwEYCRnKPQYZBZWIImkiP+RAohFxHsxl/VsxYGeLsBGcaQ Mi2VnL0eCoHLzaZInecfFnuMgQ0+ef7xdflqxQ24sE91GjlGveARr8tmZAf8eaMQhxGm g1eF8iOGffbCb/hwdY/O+Opc3GpzJ2E4tucNWrHKJAeTvxtW1i2ZDsZlgcNWlwkAW/KR 4dPGm6jelbKFQGU7lqPcq3MfIk2iPU+ggM4V4+7bMn4cQ/X79BOTfu9c03vR58sF7reJ gyDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=xuNV6O2tpAGAI3gBjBxJ2dhA7g5X0cye5gh8TZ7bVI4=; fh=isJd0JZVDkfXL73EXh8XKFxOIWM94S6/sYnFcQuWgSQ=; b=CbNHYjAe9nmRTkFfKEfN4YpYwRkzoZBhdJvjk8jakXXBmDeRNAviaWSIu6r0xTFVf7 HQGpWXcvm9JzyS+fB1LALiWo3stTA0FyHF0usKaKiXYHPe60DO/334yqlgBKFwuFkDSF 06s/FGhZj5AIBTkVUqUGsT/sPIttqtypNFo+UInqUC5kQjQd218YO+eknA138izNzvlr v1Y251EJBeQiY7y18bNeKnL+vevYkpzDxYjYwEvrUax40T4gFo8lqPKrin/hCpseeaQf 7+ICBWiApu9LZPiMDRl/wGEaYnZG3+rykArvmh0k8EfricE/t1GE8zJg/AJDahvNBQ6b HI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="t4NrV/C/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c23-20020a62e817000000b006b4ac79384csi3426414pfi.347.2023.11.04.03.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 03:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="t4NrV/C/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BBF30801BF68; Sat, 4 Nov 2023 03:52:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbjKDKwM (ORCPT + 99 others); Sat, 4 Nov 2023 06:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjKDKwL (ORCPT ); Sat, 4 Nov 2023 06:52:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 503D1191; Sat, 4 Nov 2023 03:52:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54C48C433C7; Sat, 4 Nov 2023 10:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699095128; bh=JAQzfnL7a2XNBBwy0ihLXq/4JX6Tfc5YeXjkF7JEm9s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=t4NrV/C/8GIF+0H0zbZtQPYxVDEDCMLd4m+FsVXa1Rj+XWpC22zaSCG8QXRjYLjA9 of9cchfnYtFBK0W5RasRZpy77ydRhq0H+hBkOk6YKNInyZPHlpedAe5Z2foH5DNu7A NKESoqXC1rol9dNinnXBD4gy2KLN99lMVw+KHWHgIBvLSimfrfi4S+gge536BlBNR/ PDDs5YQqjKMPTUTWA0HqvLDyO/sRdMTKvbipwuTyzvqDinmrXqUNrkiqEj9oS4Olda XN18veNqzgZy9yJYiwpivh35AM4ZG9Fx8l7V5hAfPPPEQqcVOkE+6Rd3uI8gJSHOAp 88nhJ+44DN7dA== Date: Sat, 4 Nov 2023 19:52:02 +0900 From: Masami Hiramatsu (Google) To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra , Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH 04/48] perf dwarf-aux: Fix die_get_typename() for void * Message-Id: <20231104195202.e8c300fcdc3938e2bf13f5cf@kernel.org> In-Reply-To: <20231012035111.676789-5-namhyung@kernel.org> References: <20231012035111.676789-1-namhyung@kernel.org> <20231012035111.676789-5-namhyung@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 04 Nov 2023 03:52:33 -0700 (PDT) On Wed, 11 Oct 2023 20:50:27 -0700 Namhyung Kim wrote: > The die_get_typename() is to return a C-like type name from DWARF debug > entry and it follows data type if the target entry is a pointer type. > But I found void pointers don't have the type attribte to follow and > then the function returns an error for that case. This results in a > broken type string for void pointer types. > > For example, the following type entries are pointer types. > > <1><48c>: Abbrev Number: 4 (DW_TAG_pointer_type) > <48d> DW_AT_byte_size : 8 > <48d> DW_AT_type : <0x481> > <1><491>: Abbrev Number: 211 (DW_TAG_pointer_type) > <493> DW_AT_byte_size : 8 > <1><494>: Abbrev Number: 4 (DW_TAG_pointer_type) > <495> DW_AT_byte_size : 8 > <495> DW_AT_type : <0x49e> > > The first one at offset 48c and the third one at offset 494 have type > information. Then they are pointer types for the referenced types. > But the second one at offset 491 doesn't have the type attribute. This looks good to me! Acked-by: Masami Hiramatsu (Google) Thanks! > > Cc: Masami Hiramatsu > Signed-off-by: Namhyung Kim > --- > tools/perf/util/dwarf-aux.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c > index 2941d88f2199..4849c3bbfd95 100644 > --- a/tools/perf/util/dwarf-aux.c > +++ b/tools/perf/util/dwarf-aux.c > @@ -1090,7 +1090,14 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf) > return strbuf_addf(buf, "%s%s", tmp, name ?: ""); > } > ret = die_get_typename(&type, buf); > - return ret ? ret : strbuf_addstr(buf, tmp); > + if (ret < 0) { > + /* void pointer has no type attribute */ > + if (tag == DW_TAG_pointer_type && ret == -ENOENT) > + return strbuf_addf(buf, "void*"); > + > + return ret; > + } > + return strbuf_addstr(buf, tmp); > } > > /** > -- > 2.42.0.655.g421f12c284-goog > -- Masami Hiramatsu (Google)