Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Muhammad Kamran <muhammad.kamran@arm.com>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>,
	Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	 Yury Khrustalev <Yury.Khrustalev@arm.com>,
	Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
	Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Carlos O'Donell <carlos@redhat.com>
Subject: Re: [PATCH v4 1/2] gdb: Preserve IFUNC marker when finding inferior functions
Date: Thu, 13 Aug 2026 13:38:33 +0100	[thread overview]
Message-ID: <3150c593-a3e2-4b4a-89e3-e69db038e397@arm.com> (raw)
In-Reply-To: <87a4qtllx9.fsf@redhat.com>



On 10/08/2026 22:12, Andrew Burgess wrote:
> 
> I took a look through all the feedback you received on previous
> versions, and I think everything raised has been addressed.  If you're
> happy to incorporate the two testsuite fixes I proposed above then I
> think this patch is OK.
> 
> Approved-By: Andrew Burgess <aburgess@redhat.com>
> 

Thanks for the review and the approval.

I’ve addressed your feedback in v5, which I’ve posted to the mailing
list [1].  The updated series adds the gdb_load_shlib call, includes the
minimal-symbol guard for the test’s malloc, and applies the style fixes
you suggested for patch 2.

I don’t have write access, so if everything looks OK now, could a
maintainer please commit the series for me?

Thanks,
Kamran

[1] 
https://inbox.sourceware.org/gdb-patches/20260811131219.510776-1-muhammad.kamran@arm.com/T/

> I'll take a look at patch 2/2 tomorrow, unless someone else beats me to
> it.
> 
> Thanks,
> Andrew
> 
> ---
> 
> diff --git i/gdb/valops.c w/gdb/valops.c
> index c478bdc3f15..f278d7b7cab 100644
> --- i/gdb/valops.c
> +++ w/gdb/valops.c
> @@ -113,52 +113,53 @@ struct value *
>   find_function_in_inferior (const char *name, struct objfile **objf_p)
>   {
>     struct block_symbol sym;
> +  bound_minimal_symbol msymbol;
>   
> -  sym = lookup_symbol (name, nullptr, SEARCH_TYPE_DOMAIN, nullptr);
> +  sym = lookup_symbol (name, nullptr, SEARCH_VFT, nullptr);
>     if (sym.symbol != NULL)
>       {
> -      if (objf_p)
> -	*objf_p = sym.symbol->objfile ();
> +      msymbol = find_gnu_ifunc (sym.symbol);
> +      if (msymbol.minsym == nullptr)
> +	{
> +	  if (objf_p)
> +	    *objf_p = sym.symbol->objfile ();
> +	  return value_of_variable (sym.symbol, sym.block);
> +	}
> +    }
> +  else
> +    msymbol = lookup_minimal_symbol (current_program_space, name);
>   
> -      return value_of_variable (sym.symbol, sym.block);
> +  if (msymbol.minsym != NULL)
> +    {
> +      struct objfile *objfile = msymbol.objfile;
> +      struct gdbarch *gdbarch = objfile->arch ();
> +
> +      struct type *type;
> +      CORE_ADDR maddr;
> +      type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char);
> +      type = lookup_function_type (type);
> +      type = lookup_pointer_type (type);
> +      maddr = msymbol.value_address ();
> +      minimal_symbol_type minsym_type = msymbol.minsym->type ();
> +
> +      if (minsym_type == mst_text_gnu_ifunc
> +	  || minsym_type == mst_data_gnu_ifunc)
> +	type->target_type ()->set_is_gnu_ifunc (true);
> +
> +      if (objf_p)
> +	*objf_p = objfile;
> +
> +      return value_from_pointer (type, maddr);
>       }
>     else
>       {
> -      bound_minimal_symbol msymbol
> -	= lookup_minimal_symbol (current_program_space, name);
> -
> -      if (msymbol.minsym != NULL)
> -	{
> -	  struct objfile *objfile = msymbol.objfile;
> -	  struct gdbarch *gdbarch = objfile->arch ();
> -
> -	  struct type *type;
> -	  CORE_ADDR maddr;
> -	  type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char);
> -	  type = lookup_function_type (type);
> -	  type = lookup_pointer_type (type);
> -	  maddr = msymbol.value_address ();
> -	  minimal_symbol_type minsym_type = msymbol.minsym->type ();
> -
> -	  if (minsym_type == mst_text_gnu_ifunc
> -	      || minsym_type == mst_data_gnu_ifunc)
> -	    type->target_type ()->set_is_gnu_ifunc (true);
> -
> -	  if (objf_p)
> -	    *objf_p = objfile;
> -
> -	  return value_from_pointer (type, maddr);
> -	}
> +      if (!target_has_execution ())
> +	error (_("evaluation of this expression "
> +		 "requires the target program to be active"));
>         else
> -	{
> -	  if (!target_has_execution ())
> -	    error (_("evaluation of this expression "
> -		     "requires the target program to be active"));
> -	  else
> -	    error (_("evaluation of this expression requires the "
> -		     "program to have a function \"%s\"."),
> -		   name);
> -	}
> +	error (_("evaluation of this expression requires the "
> +		 "program to have a function \"%s\"."),
> +	       name);
>       }
>   }
>   
> 


  reply	other threads:[~2026-08-13 12:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 11:04 [PATCH v4 0/2] gdb: Fix internal inferior calls through GNU IFUNCs Muhammad Kamran
2026-06-30 11:04 ` [PATCH v4 1/2] gdb: Preserve IFUNC marker when finding inferior functions Muhammad Kamran
2026-08-10 21:12   ` Andrew Burgess
2026-08-13 12:38     ` Muhammad Kamran [this message]
2026-06-30 11:04 ` [PATCH v4 2/2] gdb: Keep original IFUNC return type when target type is unknown Muhammad Kamran
2026-08-11 10:09   ` Andrew Burgess
2026-08-04  9:02 ` [PATCH v4 0/2] gdb: Fix internal inferior calls through GNU IFUNCs Muhammad Kamran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3150c593-a3e2-4b4a-89e3-e69db038e397@arm.com \
    --to=muhammad.kamran@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=Yury.Khrustalev@arm.com \
    --cc=aburgess@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=thiago.bauermann@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox