From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18677 invoked by alias); 18 Apr 2012 09:26:15 -0000 Received: (qmail 18569 invoked by uid 22791); 18 Apr 2012 09:26:12 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,TW_RG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from syracuse.mckusick.com (HELO syracuse.mckusick.com) (70.36.157.236) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 Apr 2012 09:25:58 +0000 Received: from syracuse.mckusick.com (localhost [127.0.0.1]) by syracuse.mckusick.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id q3I9PhrG029319; Wed, 18 Apr 2012 02:25:43 -0700 Received: (from hilfingr@localhost) by syracuse.mckusick.com (8.14.3/8.14.3/Submit) id q3I9Pgkw029318; Wed, 18 Apr 2012 02:25:42 -0700 From: Paul Hilfinger To: gdb-patches@sourceware.org Cc: Paul Hilfinger Subject: [RFA] Add proper handling for internal functions and STT_GNU_IFUNC symbols in Ada mode. Date: Wed, 18 Apr 2012 09:27:00 -0000 Message-Id: <1334741131-29283-1-git-send-email-Hilfinger@adacore.com> In-Reply-To: References: 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: 2012-04/txt/msg00549.txt.bz2 The code for handling calls to internal functions (esp., Python functions) and for handling STT_GNU_IFUNC had not been added to the Ada expression evaluator. This change adapts them from eval.c. gdb/Changelog: * ada-lang.c (ada_evaluate_subexp): Add cases for TYPE_CODE_INTERNAL_FUNCTION and for TYPE_GNU_IFUNC, following their treatment in eval.c. --- gdb/ada-lang.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 52e1e59..180fadb 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9717,8 +9717,25 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, { case TYPE_CODE_FUNC: if (noside == EVAL_AVOID_SIDE_EFFECTS) - return allocate_value (TYPE_TARGET_TYPE (type)); + { + struct type *rtype = TYPE_TARGET_TYPE (type); + + if (TYPE_GNU_IFUNC (type)) + return allocate_value (TYPE_TARGET_TYPE (rtype)); + return allocate_value (rtype); + } return call_function_by_hand (argvec[0], nargs, argvec + 1); + case TYPE_CODE_INTERNAL_FUNCTION: + if (noside == EVAL_AVOID_SIDE_EFFECTS) + /* We don't know anything about what the internal + function might return, but we have to return + something. */ + return value_zero (builtin_type (exp->gdbarch)->builtin_int, + not_lval); + else + return call_internal_function (exp->gdbarch, exp->language_defn, + argvec[0], nargs, argvec + 1); + case TYPE_CODE_STRUCT: { int arity; -- 1.7.0.4