Re: [PATCH v4 1/2] gdb: Preserve IFUNC marker when finding inferior functions
Muhammad Kamran <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> > 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/[email protected]/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); > } > } > >