gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 28 Mar 2011 20:24:05 +0000 (20:24 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 28 Mar 2011 20:24:05 +0000 (20:24 +0000)
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
gdb/infcall.c

index 8c156e172788dd6c72d9fdfd11d279b1ff45fa22..fc4fdbe1ff10c9ea8b13f15f8533f70708876e99 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       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  <jan.kratochvil@redhat.com>
 
        GDB find_pc_partial_function support for STT_GNU_IFUNC.
index d42248ef5196a98128a0878d538234dc1bc66775..e07cf00e3e0f1214ca7d651250503b99f78f2501 100644 (file)
@@ -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.  */
This page took 0.028044 seconds and 4 git commands to generate.