This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: S390 modernization patch 6/6


I've committed the following patch from Ulrich Weigand.  It was posted
here previously; it was reviewed and approved; and the FSF has the
software letter on file.

ChangeLog:

	* eval.c (evaluate_subexp_standard, case OP_OBJC_MSGCALL): Use 
	CORE_ADDR as type for selectors.  Correct types for GNU run time
	message lookup function to use double indirection.
	* objc-lang.c (lookup_child_selector): Use CORE_ADDR as return type.
	* objc-lang.h (lookup_child_selector): Adapt prototype.

testsuite/ChangeLog:

	* gdb.objc/basicclass.exp: Adapt to fixed return type of printHi.


diff -c -p -r gdb-head/gdb/eval.c gdb-head-new/gdb/eval.c
*** gdb-head/gdb/eval.c	Sun Nov 23 21:41:16 2003
--- gdb-head-new/gdb/eval.c	Sun Jan 18 19:56:47 2004
*************** evaluate_subexp_standard (struct type *e
*** 697,706 ****
      case OP_OBJC_MSGCALL:
        {				/* Objective C message (method) call.  */
  
! 	static unsigned long responds_selector = 0;
! 	static unsigned long method_selector = 0;
  
! 	unsigned long selector = 0;
  
  	int using_gcc = 0;
  	int struct_return = 0;
--- 697,706 ----
      case OP_OBJC_MSGCALL:
        {				/* Objective C message (method) call.  */
  
! 	static CORE_ADDR responds_selector = 0;
! 	static CORE_ADDR method_selector = 0;
  
! 	CORE_ADDR selector = 0;
  
  	int using_gcc = 0;
  	int struct_return = 0;
*************** evaluate_subexp_standard (struct type *e
*** 750,757 ****
--- 750,768 ----
  	   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
  	  {
*************** evaluate_subexp_standard (struct type *e
*** 936,949 ****
  
  	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);
  	  }
- 	else
- 	  ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
  
  	return ret;
        }
        break;
--- 947,959 ----
  
  	if (gnu_runtime && (method != NULL))
  	  {
  	    /* Function objc_msg_lookup returns a pointer.  */
! 	    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);
  	  }
  
+ 	ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
  	return ret;
        }
        break;
diff -c -p -r gdb-head/gdb/objc-lang.c gdb-head-new/gdb/objc-lang.c
*** gdb-head/gdb/objc-lang.c	Tue Oct  7 00:37:38 2003
--- gdb-head-new/gdb/objc-lang.c	Sun Jan 18 19:56:47 2004
*************** lookup_objc_class (char *classname)
*** 133,139 ****
  							   1, &classval));
  }
  
! int
  lookup_child_selector (char *selname)
  {
    struct value * function, *selstring;
--- 133,139 ----
  							   1, &classval));
  }
  
! CORE_ADDR
  lookup_child_selector (char *selname)
  {
    struct value * function, *selstring;
*************** end_msglist(void)
*** 753,759 ****
    int val = msglist_len;
    struct selname *sel = selname_chain;
    char *p = msglist_sel;
!   int selid;
  
    selname_chain = sel->next;
    msglist_len = sel->msglist_len;
--- 753,759 ----
    int val = msglist_len;
    struct selname *sel = selname_chain;
    char *p = msglist_sel;
!   CORE_ADDR selid;
  
    selname_chain = sel->next;
    msglist_len = sel->msglist_len;
diff -c -p -r gdb-head/gdb/objc-lang.h gdb-head-new/gdb/objc-lang.h
*** gdb-head/gdb/objc-lang.h	Sun Jun  8 20:27:14 2003
--- gdb-head-new/gdb/objc-lang.h	Sun Jan 18 19:56:47 2004
*************** extern int c_value_print (struct value *
*** 39,45 ****
  			  int, enum val_prettyprint);
  
  extern CORE_ADDR lookup_objc_class     (char *classname);
! extern int       lookup_child_selector (char *methodname);
  
  extern char *objc_demangle (const char *mangled, int options);
  
--- 39,45 ----
  			  int, enum val_prettyprint);
  
  extern CORE_ADDR lookup_objc_class     (char *classname);
! extern CORE_ADDR lookup_child_selector (char *methodname);
  
  extern char *objc_demangle (const char *mangled, int options);
  
diff -c -p -r gdb-head/gdb/testsuite/gdb.objc/basicclass.exp gdb-head-new/gdb/testsuite/gdb.objc/basicclass.exp
*** gdb-head/gdb/testsuite/gdb.objc/basicclass.exp	Mon Jul  7 00:27:34 2003
--- gdb-head-new/gdb/testsuite/gdb.objc/basicclass.exp	Sun Jan 18 19:56:47 2004
*************** gdb_test continue \
*** 178,184 ****
  # Test calling Objective-C methods
  #
  gdb_test "print \[self printHi\]" \
!     "Hi.*\\$\[0-9\] = -?\[0-9\]+" \
      "Call an Objective-C method with no arguments"
  
  gdb_test "print \[self printNumber: 42\]" \
--- 178,184 ----
  # Test calling Objective-C methods
  #
  gdb_test "print \[self printHi\]" \
!     "Hi.*\\$\[0-9\] = \\(.*objc_object \\*\\) 0x\[0-9a-f\]+" \
      "Call an Objective-C method with no arguments"
  
  gdb_test "print \[self printNumber: 42\]" \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]