From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8062 invoked by alias); 14 May 2009 11:36:04 -0000 Received: (qmail 8052 invoked by uid 22791); 14 May 2009 11:36:03 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate5.de.ibm.com (HELO mtagate5.de.ibm.com) (195.212.29.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 May 2009 11:35:58 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.14.3/8.13.8) with ESMTP id n4EBZtXk653034 for ; Thu, 14 May 2009 11:35:55 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.2) with ESMTP id n4EBZt8h3510358 for ; Thu, 14 May 2009 13:35:55 +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 n4EBZt46001688 for ; Thu, 14 May 2009 13:35:55 +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 SMTP id n4EBZsqG001678; Thu, 14 May 2009 13:35:54 +0200 Message-Id: <200905141135.n4EBZsqG001678@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 14 May 2009 13:35:54 +0200 Subject: [rfc] Ada simplification: ada_coerce_to_simple_array_type To: gdb-patches@sourceware.org, brobecker@adacore.com Date: Thu, 14 May 2009 11:36:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2009-05/txt/msg00295.txt.bz2 Hello, in my ongoing attempts to eliminate current_gdbarch from GDB, I've run into a couple of places in Ada-specific code that makes things difficult. This (and the following three) patches rework a couple of Ada details in order to make life simpler for my subsequent changes ... This patch addresses ada_coerce_to_simple_array_type, which creates a dummy value only to pass it to ada_type_of_array which in the end only inspects its type. Not only is that a bit wasteful; it makes a future change to create values relative to a gdbarch difficult (because there is no good choice of architecture to use for that dummy value). This patch inlines the part of ada_type_of_array that is used in the case of a "bounds == 0" parameter -- in this piece of code, only the type of the passed-in value is inspected. There should be no change in behaviour with this patch. Joel, would this be OK? Thanks, Ulrich ChangeLog: * ada-lang.c (ada_coerce_to_simple_array_type): Reimplement to avoid creating a dummy value. Index: gdb-head/gdb/ada-lang.c =================================================================== --- gdb-head.orig/gdb/ada-lang.c +++ gdb-head/gdb/ada-lang.c @@ -1689,13 +1689,13 @@ ada_coerce_to_simple_array (struct value struct type * ada_coerce_to_simple_array_type (struct type *type) { - struct value *mark = value_mark (); - struct value *dummy = value_from_longest (builtin_type_int32, 0); - struct type *result; - deprecated_set_value_type (dummy, type); - result = ada_type_of_array (dummy, 0); - value_free_to_mark (mark); - return result; + if (ada_is_packed_array_type (type)) + return decode_packed_array_type (type); + + if (ada_is_array_descriptor_type (type)) + return ada_check_typedef (TYPE_TARGET_TYPE (desc_data_type (type))); + + return type; } /* Non-zero iff TYPE represents a standard GNAT packed-array type. */ -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com