From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1958 invoked by alias); 18 Feb 2004 04:25:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1947 invoked from network); 18 Feb 2004 04:25:09 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 18 Feb 2004 04:25:09 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id i1I4P7b01779 for ; Tue, 17 Feb 2004 23:25:07 -0500 Received: from zenia.home.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i1I4P3i19781; Tue, 17 Feb 2004 23:25:04 -0500 To: gdb-patches@sources.redhat.com Subject: PATCH: S390 modernization patch 6/6 From: Jim Blandy User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Date: Wed, 18 Feb 2004 04:25:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-02/txt/msg00508.txt.bz2 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\]" \