From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23512 invoked by alias); 31 Aug 2008 17:52:23 -0000 Received: (qmail 23212 invoked by uid 22791); 31 Aug 2008 17:52:16 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 31 Aug 2008 17:51:33 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpUE2086774 for ; Sun, 31 Aug 2008 17:51:30 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7VHpUJ73743790 for ; Sun, 31 Aug 2008 19:51:30 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7VHpUDs020159 for ; Sun, 31 Aug 2008 19:51:30 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m7VHpUoO020156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 31 Aug 2008 19:51:30 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (localhost.localdomain [127.0.0.1]) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpUg3002794 for ; Sun, 31 Aug 2008 19:51:30 +0200 Received: (from uweigand@localhost) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8/Submit) id m7VHpURJ002793 for gdb-patches@sourceware.org; Sun, 31 Aug 2008 19:51:30 +0200 Message-Id: <20080831175129.946258000@de.ibm.com> References: <20080831175045.128504000@de.ibm.com> User-Agent: quilt/0.46-1 Date: Sun, 31 Aug 2008 17:53:00 -0000 From: uweigand@de.ibm.com To: gdb-patches@sourceware.org Subject: [rfc][20/37] Eliminate builtin_type_ macros: Objective-C expression evaluation Content-Disposition: inline; filename=diff-type-objc Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00698.txt.bz2 Hello, this replaces a couple of builtin_type_ uses in Objective-C expression evaluation by types associated with the expresssion's architecture. Bye, Ulrich ChangeLog: * eval.c (evaluate_subexp_standard): Use exp->gdbarch types instead of builtin_type_ macros when handling OP_OBJC_ operations. * objc-lang.c (print_object_command): Likewise. Index: gdb-head/gdb/eval.c =================================================================== --- gdb-head.orig/gdb/eval.c +++ gdb-head/gdb/eval.c @@ -999,6 +999,7 @@ evaluate_subexp_standard (struct type *e { /* Objective C @selector operator. */ char *sel = &exp->elts[pc + 2].string; int len = longest_to_int (exp->elts[pc + 1].longconst); + struct type *selector_type; (*pos) += 3 + BYTES_TO_EXP_ELEM (len + 1); if (noside == EVAL_SKIP) @@ -1006,8 +1007,9 @@ evaluate_subexp_standard (struct type *e if (sel[len] != 0) sel[len] = 0; /* Make sure it's terminated. */ - return value_from_longest (lookup_pointer_type (builtin_type_void), - lookup_child_selector (sel)); + + selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr; + return value_from_longest (selector_type, lookup_child_selector (sel)); } case OP_OBJC_MSGCALL: @@ -1030,6 +1032,7 @@ evaluate_subexp_standard (struct type *e struct value *called_method = NULL; struct type *selector_type = NULL; + struct type *long_type; struct value *ret = NULL; CORE_ADDR addr = 0; @@ -1041,7 +1044,9 @@ evaluate_subexp_standard (struct type *e (*pos) += 3; - selector_type = lookup_pointer_type (builtin_type_void); + long_type = builtin_type (exp->gdbarch)->builtin_long; + selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr; + if (noside == EVAL_AVOID_SIDE_EFFECTS) sub_no_side = EVAL_NORMAL; else @@ -1050,7 +1055,7 @@ evaluate_subexp_standard (struct type *e target = evaluate_subexp (selector_type, exp, pos, sub_no_side); if (value_as_long (target) == 0) - return value_from_longest (builtin_type_long, 0); + return value_from_longest (long_type, 0); if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0)) gnu_runtime = 1; @@ -1065,8 +1070,7 @@ evaluate_subexp_standard (struct type *e only). */ if (gnu_runtime) { - struct type *type; - type = lookup_pointer_type (builtin_type_void); + struct type *type = selector_type; type = lookup_function_type (type); type = lookup_pointer_type (type); type = lookup_function_type (type); @@ -1110,8 +1114,8 @@ evaluate_subexp_standard (struct type *e argvec[0] = msg_send; argvec[1] = target; - argvec[2] = value_from_longest (builtin_type_long, responds_selector); - argvec[3] = value_from_longest (builtin_type_long, selector); + argvec[2] = value_from_longest (long_type, responds_selector); + argvec[3] = value_from_longest (long_type, selector); argvec[4] = 0; ret = call_function_by_hand (argvec[0], 3, argvec + 1); @@ -1132,8 +1136,8 @@ evaluate_subexp_standard (struct type *e argvec[0] = msg_send; argvec[1] = target; - argvec[2] = value_from_longest (builtin_type_long, method_selector); - argvec[3] = value_from_longest (builtin_type_long, selector); + argvec[2] = value_from_longest (long_type, method_selector); + argvec[3] = value_from_longest (long_type, selector); argvec[4] = 0; ret = call_function_by_hand (argvec[0], 3, argvec + 1); @@ -1252,7 +1256,7 @@ evaluate_subexp_standard (struct type *e argvec[0] = called_method; argvec[1] = target; - argvec[2] = value_from_longest (builtin_type_long, selector); + argvec[2] = value_from_longest (long_type, selector); /* User-supplied arguments. */ for (tem = 0; tem < nargs; tem++) argvec[tem + 3] = evaluate_subexp_with_coercion (exp, pos, noside); Index: gdb-head/gdb/objc-lang.c =================================================================== --- gdb-head.orig/gdb/objc-lang.c +++ gdb-head/gdb/objc-lang.c @@ -1378,7 +1378,7 @@ print_object_command (char *args, int fr int pc = 0; object = expr->language_defn->la_exp_desc->evaluate_exp - (builtin_type_void_data_ptr, expr, &pc, EVAL_NORMAL); + (builtin_type (expr->gdbarch)->builtin_data_ptr, expr, &pc, EVAL_NORMAL); do_cleanups (old_chain); } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com