From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0ZN1NWj1emo24hwAWB0awg (envelope-from ) for ; Tue, 11 Aug 2026 06:11:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QRVJxtN9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D623C1E033; Tue, 11 Aug 2026 06:11:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 68AD01E033 for ; Tue, 11 Aug 2026 06:11:52 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B1D4B4BA9012 for ; Tue, 11 Aug 2026 10:11:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1D4B4BA9012 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QRVJxtN9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 7AC824BA23C1 for ; Tue, 11 Aug 2026 10:11:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AC824BA23C1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7AC824BA23C1 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786443086; cv=none; b=PkE9QxdWV3dRgsGzg7rIM+Ho5SXYJ4qd3R7nyvCu7ipb2bwOOXqqBb1MxBFsIA98X3tweqhyYWKDmqUzrMUAH1CtfQXL08dkQnPyrA4jqo3tv3MHliZPHxb7+riW5yE7YXFdQTc8JEg5+/Uhb3jRo2HwSUYZKYn6/iRcY85UaZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786443086; c=relaxed/simple; bh=YJ98/DTdsnGlw7VYnCdYqzUZLAbDM9KPjgDPSz7KmBA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=v755rsgsT/89U4SncTZ7KPq+1W7TRIv3jg0urlpXvaujDvGc7HkEG63EOlye6FN8FzPxQGr5ORFMQvJZETpTefjICLRcYJR5TK/K9Hj+/gnw4Rx/U52w9CnPOWitqtuRPGaK+x9VYVcDSzl6kdMsHifkil44Y3B95IGVEoCWxpo= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QRVJxtN9 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AC824BA23C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786443086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c7IeXqXtI4bvMF9sYqdpV63VJ2Qs/4z0vQH4rXTTRGg=; b=QRVJxtN9+PzqIJaJC3Ir2DeRJJbRYZYamFwMxK7LwPaq31jlPvFbWvcj+7DKxZvL5Cp7r9 1s1viFjOcW2lkV5hmMc//UonyDTc1hrVzqMrhZQNqPJEhyrVkQK50P5WG4Vuyc5JE5cAYC lZtlbDq9HqsYuOgX6aB2KU1pDjivwwk= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-9N9riLIfMc2A1md_VJsW4Q-1; Tue, 11 Aug 2026 06:11:14 -0400 X-MC-Unique: 9N9riLIfMc2A1md_VJsW4Q-1 X-Mimecast-MFC-AGG-ID: 9N9riLIfMc2A1md_VJsW4Q_1786443074 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-47fe85684b9so2414055f8f.3 for ; Tue, 11 Aug 2026 03:11:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786443073; x=1787047873; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=c7IeXqXtI4bvMF9sYqdpV63VJ2Qs/4z0vQH4rXTTRGg=; b=ldcqAHvGo5VpuUDFHH2P6l+iKZ/E9j67CY9gN01UFu0JulV8IzqQqdbMU6REBHoAEM ZYaMoQuEIAfUgy++fV+75jJoEh+uTizbqm7P4sLLGlupVzqs0g/xukn3VGRa++12R96a 6FaN/V6oOgogYv5c3rtWGOiBaZ27T5Tamv4OqcTgix84om8AwuVw9D2NUc+BjicDvgPj LV1MOUBPi+9e6koGbqYxVr+9qTbxZzhN8qpenRT+U9mJTfR+P8Yb+MhTJLv74ukfST2n Uxb00jLKgj+EpJiIkWvaRRFl7MxJU+KImC7ZDt7gVmpV3l1VArXe0pvhnNnb31Wbs5Td 6P2Q== X-Forwarded-Encrypted: i=1; AHgh+RpWUY8aygHXrMKvdZueq1UjS5+A2HGOe7awZulhCl5Z7KVMJlnei/E0wnQxeWFCmYrc9V60cY6psfB4LQ==@sourceware.org X-Gm-Message-State: AOJu0YyAFdtR1kyeqLE8aXlQVreWgYalKLsQy0+zs2mIDSLfkl+EvUWs VCK5dJUq42MH9pNtgwyprWDhlPm+fHpR6rn/KGt/nramF9X3ciANaTvh2DHoYsn9OVj6DKVeWmA QLM28r8/+7akbnTA0PzyTw3epjQtocPcW/WpvRDf3x2HQ5AJxNvqpTptPDPQseprgagwASFM= X-Gm-Gg: AR+sD10Nn0+q0yW5cOG1JzKakoyjaz90gmokTKnDkkuuiicQTf9DLDv92diYuNdMQB4 9E60Ow8uFvfg+QYbQ46Pv0SWdQyRbpnKbuxcgrwuSuOafw8cg7DP0TRfA4pR4KLoZ02XX32IE+O LbixwVtubCYbt221Of+BSWDH764G86RBfGoP9J6Bz5ZTPdZoPHbmFZmNet5LmKXxlP7IP/2ff19 6vWNgYb1TZv3cHt5lsxPA5ZyCLOfr1zIJG4A0KGQm72kOBFjrZaezc1Z+803STzzl556WUleJmO DAPT2G1S22pPM58SyC9cUphb96OtOSkCW487KRTkh+autdL7dQlxI3kYugqOfqXsU1SXZTXc X-Received: by 2002:a05:6000:2c0d:b0:47f:5ec2:d54 with SMTP id ffacd0b85a97d-4814ad7f98emr3072122f8f.5.1786443073550; Tue, 11 Aug 2026 03:11:13 -0700 (PDT) X-Received: by 2002:a05:6000:2c0d:b0:47f:5ec2:d54 with SMTP id ffacd0b85a97d-4814ad7f98emr3072040f8f.5.1786443073015; Tue, 11 Aug 2026 03:11:13 -0700 (PDT) Received: from localhost ([31.111.209.128]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4814a72cea1sm3610590f8f.37.2026.08.11.03.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 03:09:39 -0700 (PDT) From: Andrew Burgess To: Muhammad Kamran , gdb-patches@sourceware.org Cc: Simon Marchi , Wilco Dijkstra , Yury Khrustalev , Thiago Jung Bauermann , Adhemerval Zanella Netto , Carlos O'Donell , Muhammad Kamran Subject: Re: [PATCH v4 2/2] gdb: Keep original IFUNC return type when target type is unknown In-Reply-To: <20260630110443.12900-3-muhammad.kamran@arm.com> References: <20260630110443.12900-1-muhammad.kamran@arm.com> <20260630110443.12900-3-muhammad.kamran@arm.com> Date: Tue, 11 Aug 2026 11:09:38 +0100 Message-ID: <871pc5kly5.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: oEtj6k4Vn32p9HqMroHluCDfhmdGDITCeIbgpjkwa2g_1786443074 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Muhammad Kamran writes: > When find_function_addr resolves a GNU IFUNC, it tries to replace the > original function type with the resolved target type, or with the type > returned by the resolver. If neither source provides a useful return > type, keep the return type from the original function value. > > This matters for internal inferior calls such as > find_function_in_inferior ("malloc"), where GDB creates a synthetic > function type with a known fallback return type. > > Remove the guard from the IFUNC inferior-call test so the no-debug > resolver/no-debug target variants are tested too. It is probably worth adding the Bug: link from the previous commit here too. > --- > gdb/infcall.c | 12 ++++++++++-- > gdb/testsuite/gdb.base/gnu-ifunc.exp | 7 ------- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/gdb/infcall.c b/gdb/infcall.c > index e6b24ff5310..077407073ac 100644 > --- a/gdb/infcall.c > +++ b/gdb/infcall.c > @@ -395,6 +395,9 @@ find_function_addr (struct value *function, > FUNCTION_TYPE have been asked for. */ > if (retval_type != NULL || function_type != NULL) > { > + /* Default to original function type's return type. Target type > + replaces this only if it provides a usable return type. */ > + value_type = ftype->target_type (); > type *target_ftype = find_function_type (funaddr); > /* If we don't have debug info for the target function, > see if we can instead extract the target function's > @@ -403,8 +406,13 @@ find_function_addr (struct value *function, > target_ftype = find_gnu_ifunc_target_type (resolver_addr); > if (target_ftype != NULL) > { > - value_type = check_typedef (target_ftype)->target_type (); > - ftype = target_ftype; > + struct type *target_value_type I think you should drop the 'struct' here. Newer GDB code avoids the 'struct' where possible. This function has a mix so I think adopting the new style would be best. > + = check_typedef (target_ftype)->target_type (); > + if (target_value_type != NULL) Replace 'NULL' with 'nullptr' in new code please. With those minor fixes: Approved-By: Andrew Burgess Thanks, Andrew