2002-02-03 Daniel Jacobowitz <drow@mvista.com>
authorDaniel Jacobowitz <drow@false.org>
Mon, 4 Feb 2002 02:14:46 +0000 (02:14 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 4 Feb 2002 02:14:46 +0000 (02:14 +0000)
        * c-valprint.c (c_val_print): Pass a proper valaddr to
        cp_print_class_method.
        * valops.c (search_struct_method): If there is only one method
        and args is NULL, return that method.

gdb/ChangeLog
gdb/c-valprint.c
gdb/valops.c

index 37b4abda707d7ed01e468948587a8cdf41c6ca2e..be9fe6d013dbb66d47333ae693c15f76e750d034 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-03  Daniel Jacobowitz  <drow@mvista.com>
+
+       * c-valprint.c (c_val_print): Pass a proper valaddr to
+       cp_print_class_method.
+       * valops.c (search_struct_method): If there is only one method
+       and args is NULL, return that method.
+
 2002-02-03  Daniel Jacobowitz  <drow@mvista.com>
 
        * gdbtypes.c (init_simd_type): Use TYPE_TAG_NAME instead of
index c9109f0fb808b337d2319568ee03403593b01ec9..c094a17ad886c19739edb20cd3198fd77a241a54 100644 (file)
@@ -441,8 +441,12 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_METHOD:
-      cp_print_class_method (valaddr + embedded_offset, lookup_pointer_type (type), stream);
-      break;
+      {
+       struct value *v = value_at (type, address, NULL);
+       cp_print_class_method (VALUE_CONTENTS (value_addr (v)),
+                              lookup_pointer_type (type), stream);
+       break;
+      }
 
     case TYPE_CODE_VOID:
       fprintf_filtered (stream, "void");
index f211753c4a76a4552861dcff9866335949ab447c..6f7e25141d6843146457c3340bd8e8449e73e5d4 100644 (file)
@@ -2274,23 +2274,32 @@ search_struct_method (char *name, struct value **arg1p,
 
          if (j > 0 && args == 0)
            error ("cannot resolve overloaded method `%s': no arguments supplied", name);
-         while (j >= 0)
+         else if (j == 0 && args == 0)
            {
              if (TYPE_FN_FIELD_STUB (f, j))
                check_stub_method (type, i, j);
-             if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
-                           TYPE_FN_FIELD_ARGS (f, j), args))
-               {
-                 if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
-                   return value_virtual_fn_field (arg1p, f, j, type, offset);
-                 if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
-                   *static_memfuncp = 1;
-                 v = value_fn_field (arg1p, f, j, type, offset);
-                 if (v != NULL)
-                   return v;       
-               }
-             j--;
+             v = value_fn_field (arg1p, f, j, type, offset);
+             if (v != NULL)
+               return v;
            }
+         else
+           while (j >= 0)
+             {
+               if (TYPE_FN_FIELD_STUB (f, j))
+                 check_stub_method (type, i, j);
+               if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
+                             TYPE_FN_FIELD_ARGS (f, j), args))
+                 {
+                   if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
+                     return value_virtual_fn_field (arg1p, f, j, type, offset);
+                   if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
+                     *static_memfuncp = 1;
+                   v = value_fn_field (arg1p, f, j, type, offset);
+                   if (v != NULL)
+                     return v;       
+                 }
+               j--;
+             }
        }
     }