Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Hilfinger <hilfingr@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA]: Turn on initial Ada support in GDB (symtab portion)
Date: Wed, 29 Sep 2004 08:01:00 -0000	[thread overview]
Message-ID: <20040929080131.69458F29C4@nile.gnat.com> (raw)


This is the symtab.c portion of our Ada-support patch.  Andrew requested
that I break it out and post it separately.  My recollection was that 
it was approved some time ago, but no harm in making sure.   See also 
my 9/27 posting.

Still OK?

Paul Hilfinger



2004-09-27  Paul N. Hilfinger  <Hilfinger@gnat.com>

	* symtab.c: Add dependency on ada-lang.h.
	(symbol_natural_name, symbol_demangled_name)
	(symbol_search_name): Add Ada case.

Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.139
diff -u -p -r1.139 symtab.c
--- gdb/symtab.c	20 Sep 2004 20:18:39 -0000	1.139
+++ gdb/symtab.c	27 Sep 2004 10:18:47 -0000
@@ -41,6 +41,7 @@
 #include "source.h"
 #include "filenames.h"		/* for FILENAME_CMP */
 #include "objc-lang.h"
+#include "ada-lang.h"
 
 #include "hashtab.h"
 
@@ -634,17 +635,24 @@ symbol_init_demangled_name (struct gener
 char *
 symbol_natural_name (const struct general_symbol_info *gsymbol)
 {
-  if ((gsymbol->language == language_cplus
-       || gsymbol->language == language_java
-       || gsymbol->language == language_objc)
-      && (gsymbol->language_specific.cplus_specific.demangled_name != NULL))
+  switch (gsymbol->language) 
     {
-      return gsymbol->language_specific.cplus_specific.demangled_name;
-    }
-  else
-    {
-      return gsymbol->name;
+    case language_cplus:
+    case language_java:
+    case language_objc:
+      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
+	return gsymbol->language_specific.cplus_specific.demangled_name;
+      break;
+    case language_ada:
+      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
+	return gsymbol->language_specific.cplus_specific.demangled_name;
+      else
+	return ada_decode_symbol (gsymbol);
+      break;
+    default:
+      break;
     }
+  return gsymbol->name;
 }
 
 /* Return the demangled name for a symbol based on the language for
@@ -652,13 +660,24 @@ symbol_natural_name (const struct genera
 char *
 symbol_demangled_name (struct general_symbol_info *gsymbol)
 {
-  if (gsymbol->language == language_cplus
-      || gsymbol->language == language_java
-      || gsymbol->language == language_objc)
-    return gsymbol->language_specific.cplus_specific.demangled_name;
-
-  else 
-    return NULL;
+  switch (gsymbol->language) 
+    {
+    case language_cplus:
+    case language_java:
+    case language_objc:
+      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
+	return gsymbol->language_specific.cplus_specific.demangled_name;
+      break;
+    case language_ada:
+      if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
+	return gsymbol->language_specific.cplus_specific.demangled_name;
+      else
+	return ada_decode_symbol (gsymbol);
+      break;
+    default:
+      break;
+    }
+  return NULL;
 }
 
 /* Return the search name of a symbol---generally the demangled or
@@ -666,7 +685,10 @@ symbol_demangled_name (struct general_sy
    If there is no distinct demangled name, then returns the same value 
    (same pointer) as SYMBOL_LINKAGE_NAME. */
 char *symbol_search_name (const struct general_symbol_info *gsymbol) {
-  return symbol_natural_name (gsymbol);
+  if (gsymbol->language == language_ada)
+    return gsymbol->name;
+  else
+    return symbol_natural_name (gsymbol);
 }
 
 /* Initialize the structure fields to zero values.  */


             reply	other threads:[~2004-09-29  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29  8:01 Paul Hilfinger [this message]
2004-09-29 22:33 ` Jim Blandy

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=20040929080131.69458F29C4@nile.gnat.com \
    --to=hilfingr@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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