Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: brobecker@adacore.com (Joel Brobecker)
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Ada simplification: ada_find_any_type
Date: Mon, 18 May 2009 14:01:00 -0000	[thread overview]
Message-ID: <200905181401.n4IE1E9t019519@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20090515151429.GN7292@adacore.com> from "Joel Brobecker" at May 15, 2009 05:14:29 PM

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


      reply	other threads:[~2009-05-18 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 11:38 Ulrich Weigand
2009-05-15 15:14 ` Joel Brobecker
2009-05-18 14:01   ` Ulrich Weigand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200905181401.n4IE1E9t019519@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox