2004-04-22 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / eval.c
index 95a2e4a3f8ef42922d8194d9daef623c1ac2c72f..b690a78da09e6807e5628b1dc22ff365c1839a29 100644 (file)
@@ -37,9 +37,6 @@
 #include "block.h"
 #include "parser-defs.h"
 
-/* Defined in symtab.c */
-extern int hp_som_som_object_present;
-
 /* This is defined in valops.c */
 extern int overload_resolution;
 
@@ -697,10 +694,10 @@ evaluate_subexp_standard (struct type *expect_type,
     case OP_OBJC_MSGCALL:
       {                                /* Objective C message (method) call.  */
 
-       static unsigned long responds_selector = 0;
-       static unsigned long method_selector = 0;
+       static CORE_ADDR responds_selector = 0;
+       static CORE_ADDR method_selector = 0;
 
-       unsigned long selector = 0;
+       CORE_ADDR selector = 0;
 
        int using_gcc = 0;
        int struct_return = 0;
@@ -750,8 +747,19 @@ evaluate_subexp_standard (struct type *expect_type,
           only).  */
        if (gnu_runtime)
          {
+           struct type *type;
+           type = lookup_pointer_type (builtin_type_void);
+           type = lookup_function_type (type);
+           type = lookup_pointer_type (type);
+           type = lookup_function_type (type);
+           type = lookup_pointer_type (type);
+
            msg_send = find_function_in_inferior ("objc_msg_lookup");
            msg_send_stret = find_function_in_inferior ("objc_msg_lookup");
+
+           msg_send = value_from_pointer (type, value_as_address (msg_send));
+           msg_send_stret = value_from_pointer (type, 
+                                       value_as_address (msg_send_stret));
          }
        else
          {
@@ -936,14 +944,13 @@ evaluate_subexp_standard (struct type *expect_type,
 
        if (gnu_runtime && (method != NULL))
          {
-           ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
            /* Function objc_msg_lookup returns a pointer.  */
-           argvec[0] = ret;
-           ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
+           VALUE_TYPE (argvec[0]) = lookup_function_type 
+                           (lookup_pointer_type (VALUE_TYPE (argvec[0])));
+           argvec[0] = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
          }
-       else
-         ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
 
+       ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
        return ret;
       }
       break;
@@ -962,7 +969,7 @@ evaluate_subexp_standard (struct type *expect_type,
          /* 1997-08-01 Currently we do not support function invocation
             via pointers-to-methods with HP aCC. Pointer does not point
             to the function, but possibly to some thunk. */
-         if (hp_som_som_object_present)
+         if (deprecated_hp_som_som_object_present)
            {
              error ("Not implemented: function invocation through pointer to method with HP aCC");
            }
@@ -1358,7 +1365,7 @@ evaluate_subexp_standard (struct type *expect_type,
       arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
 
       /* With HP aCC, pointers to methods do not point to the function code */
-      if (hp_som_som_object_present &&
+      if (deprecated_hp_som_som_object_present &&
          (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR) &&
       (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_METHOD))
        error ("Pointers to methods not supported with HP aCC");        /* 1997-08-19 */
@@ -1371,7 +1378,7 @@ evaluate_subexp_standard (struct type *expect_type,
       arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
 
       /* With HP aCC, pointers to methods do not point to the function code */
-      if (hp_som_som_object_present &&
+      if (deprecated_hp_som_som_object_present &&
          (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR) &&
       (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_METHOD))
        error ("Pointers to methods not supported with HP aCC");        /* 1997-08-19 */
@@ -1381,7 +1388,7 @@ evaluate_subexp_standard (struct type *expect_type,
     handle_pointer_to_member:
       /* HP aCC generates offsets that have bit #29 set; turn it off to get
          a real offset to the member. */
-      if (hp_som_som_object_present)
+      if (deprecated_hp_som_som_object_present)
        {
          if (!mem_offset)      /* no bias -> really null */
            error ("Attempted dereference of null pointer-to-member");
@@ -1421,7 +1428,7 @@ evaluate_subexp_standard (struct type *expect_type,
       arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
 
       /* Do special stuff for HP aCC pointers to members */
-      if (hp_som_som_object_present)
+      if (deprecated_hp_som_som_object_present)
        {
          /* 1997-08-19 Can't assign HP aCC pointers to methods. No details of
             the implementation yet; but the pointer appears to point to a code
@@ -1924,7 +1931,7 @@ evaluate_subexp_standard (struct type *expect_type,
        {
          struct value *retvalp = evaluate_subexp_for_address (exp, pos, noside);
          /* If HP aCC object, use bias for pointers to members */
-         if (hp_som_som_object_present &&
+         if (deprecated_hp_som_som_object_present &&
              (TYPE_CODE (VALUE_TYPE (retvalp)) == TYPE_CODE_PTR) &&
              (TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (retvalp))) == TYPE_CODE_MEMBER))
            {
This page took 0.027354 seconds and 4 git commands to generate.