From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 731 invoked by alias); 18 May 2009 14:01:27 -0000 Received: (qmail 31870 invoked by uid 22791); 18 May 2009 14:01:23 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.17.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 May 2009 14:01:18 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id n4IE1GdP029456 for ; Mon, 18 May 2009 14:01:16 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 n4IE1GOa1016060 for ; Mon, 18 May 2009 16:01:16 +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 n4IE1Fpf019573 for ; Mon, 18 May 2009 16:01:15 +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 n4IE1E9t019519; Mon, 18 May 2009 16:01:14 +0200 Message-Id: <200905181401.n4IE1E9t019519@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 18 May 2009 16:01:14 +0200 Subject: Re: [rfc] Ada simplification: ada_find_any_type To: brobecker@adacore.com (Joel Brobecker) Date: Mon, 18 May 2009 14:01:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20090515151429.GN7292@adacore.com> from "Joel Brobecker" at May 15, 2009 05:14:29 PM 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/msg00362.txt.bz2 Joel Brobecker wrote: > > > > * ada-lang.c (ada_find_any_type): Move check for primitive types ... > > (to_fixed_range_type): ... to here. > > Looks OK as well. > > Would you mind extending the description of ada_find_any_type to > say that it does not search the primitive types? Otherwise, I'm afraid > that we might come across a situation one day where we want to search > the primitive types after a call to that function, and add it back > in that function because we weren't paying attention... Certainly -- here's what I checked in. Thanks, Ulrich ChangeLog: * ada-lang.c (ada_find_any_type): Move check for primitive types ... (to_fixed_range_type): ... to here. Index: gdb-head/gdb/ada-lang.c =================================================================== --- gdb-head.orig/gdb/ada-lang.c +++ gdb-head/gdb/ada-lang.c @@ -6481,22 +6481,19 @@ ada_find_any_symbol (const char *name) return sym; } -/* Find a type named NAME. Ignores ambiguity. */ +/* Find a type named NAME. Ignores ambiguity. This routine will look + solely for types defined by debug info, it will not search the GDB + primitive types. */ struct type * ada_find_any_type (const char *name) { struct symbol *sym = ada_find_any_symbol (name); - struct type *type = NULL; if (sym != NULL) - type = SYMBOL_TYPE (sym); + return SYMBOL_TYPE (sym); - if (type == NULL) - type = language_lookup_primitive_type_by_name - (language_def (language_ada), current_gdbarch, name); - - return type; + return NULL; } /* Given NAME and an associated BLOCK, search all symbols for @@ -9451,6 +9448,11 @@ to_fixed_range_type (char *name, struct struct type *base_type; char *subtype_info; + /* Also search primitive types if type symbol could not be found. */ + if (raw_type == NULL) + raw_type = language_lookup_primitive_type_by_name + (language_def (language_ada), current_gdbarch, name); + if (raw_type == NULL) base_type = builtin_type_int32; else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com