From 300f8e104fa748aa73b49f38add5a38d93ce41a2 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 28 Mar 2011 20:24:05 +0000 Subject: [PATCH] gdb/ Code cleanup for later STT_GNU_IFUNC support. * infcall.c (find_function_addr): Remove variable code, use explicit dereferences for it. Move VALUE_TYPE initialization later. --- gdb/ChangeLog | 6 ++++++ gdb/infcall.c | 23 ++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8c156e17278..fc4fdbe1ff1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-03-28 Jan Kratochvil + + Code cleanup for later STT_GNU_IFUNC support. + * infcall.c (find_function_addr): Remove variable code, use explicit + dereferences for it. Move VALUE_TYPE initialization later. + 2011-03-28 Jan Kratochvil GDB find_pc_partial_function support for STT_GNU_IFUNC. diff --git a/gdb/infcall.c b/gdb/infcall.c index d42248ef519..e07cf00e3e0 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -236,7 +236,6 @@ find_function_addr (struct value *function, struct type **retval_type) { struct type *ftype = check_typedef (value_type (function)); struct gdbarch *gdbarch = get_type_arch (ftype); - enum type_code code = TYPE_CODE (ftype); struct type *value_type = NULL; CORE_ADDR funaddr; @@ -244,24 +243,22 @@ find_function_addr (struct value *function, struct type **retval_type) part of it. */ /* Determine address to call. */ - if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) - { - funaddr = value_address (function); - value_type = TYPE_TARGET_TYPE (ftype); - } - else if (code == TYPE_CODE_PTR) + if (TYPE_CODE (ftype) == TYPE_CODE_FUNC + || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + funaddr = value_address (function); + else if (TYPE_CODE (ftype) == TYPE_CODE_PTR) { funaddr = value_as_address (function); ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) - { - funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, - ¤t_target); - value_type = TYPE_TARGET_TYPE (ftype); - } + funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, + ¤t_target); } - else if (code == TYPE_CODE_INT) + if (TYPE_CODE (ftype) == TYPE_CODE_FUNC + || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + value_type = TYPE_TARGET_TYPE (ftype); + else if (TYPE_CODE (ftype) == TYPE_CODE_INT) { /* Handle the case of functions lacking debugging info. Their values are characters since their addresses are char. */ -- 2.30.2