summaryrefslogtreecommitdiff
path: root/gdb/infcall.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-03-28 20:24:04 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-03-28 20:24:04 +0000
commit26d160eaebc737c1a45f07f99c80cce979874aac (patch)
tree37ce5e58b92dde17e236a63698b6c51543e8d04e /gdb/infcall.c
parentf10617c2cd5f8a2951fba9b3a256726f8e0dec8a (diff)
downloadgdb-26d160eaebc737c1a45f07f99c80cce979874aac.tar.gz
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.
Diffstat (limited to 'gdb/infcall.c')
-rw-r--r--gdb/infcall.c23
1 files changed, 10 insertions, 13 deletions
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,
- &current_target);
- value_type = TYPE_TARGET_TYPE (ftype);
- }
+ funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
+ &current_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. */