diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-03-28 20:26:24 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-03-28 20:26:24 +0000 |
commit | 07be84bf8f6a00301ce539a651d1bc717e402b8f (patch) | |
tree | 42a487e082944e82b3da5d47b1c97d4cbca54d2d /gdb/infcall.c | |
parent | 300f8e104fa748aa73b49f38add5a38d93ce41a2 (diff) | |
download | gdb-07be84bf8f6a00301ce539a651d1bc717e402b8f.zip gdb-07be84bf8f6a00301ce539a651d1bc717e402b8f.tar.gz gdb-07be84bf8f6a00301ce539a651d1bc717e402b8f.tar.bz2 |
gdb/
STT_GNU_IFUNC reader implementation.
* elfread.c: Include gdbtypes.h, value.h and infcall.h.
(SYMBOL_GOT_PLT_SUFFIX, elf_rel_plt_read)
(elf_objfile_gnu_ifunc_cache_data, struct elf_gnu_ifunc_cache)
(elf_gnu_ifunc_cache_hash, elf_gnu_ifunc_cache_eq)
(elf_gnu_ifunc_record_cache, elf_gnu_ifunc_resolve_by_cache)
(elf_gnu_ifunc_resolve_by_got, elf_gnu_ifunc_resolve_name)
(elf_gnu_ifunc_resolve_addr): New.
(elf_symfile_read): Call elf_rel_plt_read.
(elf_gnu_ifunc_fns): New.
(_initialize_elfread): Initialize elf_objfile_gnu_ifunc_cache_data.
Install elf_gnu_ifunc_fns.
* infcall.c (find_function_return_type): New function.
(find_function_addr): Resolve TYPE_GNU_IFUNC functions, if possible.
* minsyms.c (stub_gnu_ifunc_resolve_addr)
(stub_gnu_ifunc_resolve_name): New functions.
(stub_gnu_ifunc_fns, gnu_ifunc_fns_p): New variables.
* symtab.h (struct gnu_ifunc_fns, gnu_ifunc_resolve_addr)
(gnu_ifunc_resolve_name, gnu_ifunc_fns_p): New.
Diffstat (limited to 'gdb/infcall.c')
-rw-r--r-- | gdb/infcall.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/infcall.c b/gdb/infcall.c index e07cf00..ca23704 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -228,6 +228,21 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, return value_cast (type, arg); } +/* Return the return type of a function with its first instruction exactly at + the PC address. Return NULL otherwise. */ + +static struct type * +find_function_return_type (CORE_ADDR pc) +{ + struct symbol *sym = find_pc_function (pc); + + if (sym != NULL && BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == pc + && SYMBOL_TYPE (sym) != NULL) + return TYPE_TARGET_TYPE (SYMBOL_TYPE (sym)); + + return NULL; +} + /* Determine a function's address and its return type from its value. Calls error() if the function is not valid for calling. */ @@ -257,7 +272,19 @@ find_function_addr (struct value *function, struct type **retval_type) } if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) - value_type = TYPE_TARGET_TYPE (ftype); + { + value_type = TYPE_TARGET_TYPE (ftype); + + if (TYPE_GNU_IFUNC (ftype)) + { + funaddr = gnu_ifunc_resolve_addr (gdbarch, funaddr); + + /* Skip querying the function symbol if no RETVAL_TYPE has been + asked for. */ + if (retval_type) + value_type = find_function_return_type (funaddr); + } + } else if (TYPE_CODE (ftype) == TYPE_CODE_INT) { /* Handle the case of functions lacking debugging info. |