Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Adam Fedor <fedor@doc.com>
To: GDB Patches <gdb-patches@sources.redhat.com>
Cc: Michael Snyder <msnyder@redhat.com>,
	 Elena Zannoni <ezannoni@redhat.com>
Subject: Re: [RFA] Demangle ObjC symbols in symtab.c [4/5]
Date: Sat, 11 Jan 2003 04:01:00 -0000	[thread overview]
Message-ID: <3E1F971E.4020204@doc.com> (raw)
In-Reply-To: <3E1637DA.BFD960F9@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]


Michael Snyder wrote:
> Adam Fedor wrote:
> 
>>2003-01-03  Adam Fedor  <fedor@gnu.org>
>>
>>        * symtab.c (symbol_init_demangled_name): Check for and demangle
>>        ObjC symbols.
>>        (make_symbol_completion_list): Look for ObjC symbols
> 
> 
> Not to be too fussy, but these two changes seem unrelated.
> It might be better to submit them separately.  Easier to 
> review and approve.
> 

Here's the first half of the patch again with a small change.


[-- Attachment #2: objc22a.patch --]
[-- Type: text/plain, Size: 2969 bytes --]

2003-01-10  Adam Fedor  <fedor@gnu.org>

	* symtab.c (symbol_init_demangled_name): Check for and demangle
	ObjC symbols.

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.84
diff -u -p -r1.84 symtab.c
--- symtab.c	2 Jan 2003 14:27:26 -0000	1.84
+++ symtab.c	11 Jan 2003 03:51:34 -0000
@@ -40,6 +40,7 @@
 #include "linespec.h"
 #include "source.h"
 #include "filenames.h"		/* for FILENAME_CMP */
+#include "objc-lang.h"
 
 #include "gdb_obstack.h"
 
@@ -440,15 +441,31 @@ void
 symbol_init_demangled_name (struct general_symbol_info *gsymbol,
                             struct obstack *obstack)
 {
-  char *mangled = gsymbol->name;
-  char *demangled = NULL;
-
   if (gsymbol->language == language_unknown)
     gsymbol->language = language_auto;
+
+  if (gsymbol->language == language_objc
+      || gsymbol->language == language_auto)
+    {
+      char *demangled =
+	objc_demangle (gsymbol->name);
+      if (demangled != NULL)
+	{
+	  gsymbol->language = language_objc;
+	  gsymbol->language_specific.objc_specific.demangled_name =
+	    obsavestring (demangled, strlen (demangled), (obstack));
+	  xfree (demangled);
+	}
+      else
+	{
+	  gsymbol->language_specific.objc_specific.demangled_name = NULL;
+	}
+    }
+  
   if (gsymbol->language == language_cplus
       || gsymbol->language == language_auto)
     {
-      demangled =
+      char *demangled =
         cplus_demangle (gsymbol->name, DMGL_PARAMS | DMGL_ANSI);
       if (demangled != NULL)
         {
@@ -462,9 +479,10 @@ symbol_init_demangled_name (struct gener
           gsymbol->language_specific.cplus_specific.demangled_name = NULL;
         }
     }
+
   if (gsymbol->language == language_java)
     {
-      demangled =
+      char *demangled =
         cplus_demangle (gsymbol->name,
                         DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);
       if (demangled != NULL)
@@ -831,7 +849,7 @@ lookup_symbol_aux (const char *name, con
     }
 #endif /* 0 */
 
-  /* C++: If requested to do so by the caller, 
+  /* C++/Java/Objective-C: If requested to do so by the caller, 
      check to see if NAME is a field of `this'. */
   if (is_a_field_of_this)
     {
@@ -1483,9 +1501,9 @@ find_main_psymtab (void)
    for now we don't worry about the slight inefficiency of looking for
    a match we'll never find, since it will go pretty quick.  Once the
    binary search terminates, we drop through and do a straight linear
-   search on the symbols.  Each symbol which is marked as being a C++
-   symbol (language_cplus set) has both the encoded and non-encoded names
-   tested for a match.
+   search on the symbols.  Each symbol which is marked as being a ObjC/C++
+   symbol (language_cplus or language_objc set) has both the encoded and 
+   non-encoded names tested for a match.
 
    If MANGLED_NAME is non-NULL, verify that any symbol we find has this
    particular mangled name.

  reply	other threads:[~2003-01-11  4:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 23:03 Adam Fedor
2003-01-04  1:25 ` Michael Snyder
2003-01-11  4:01   ` Adam Fedor [this message]
2003-02-19 14:59     ` Elena Zannoni
2003-02-19 15:15       ` Elena Zannoni
2003-02-19 16:48         ` Adam Fedor
2003-01-06 21:42 ` Elena Zannoni
2003-01-07 23:14   ` Daniel Jacobowitz
2003-01-11  3:59   ` Adam Fedor
2003-01-11  5:24     ` Daniel Jacobowitz

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=3E1F971E.4020204@doc.com \
    --to=fedor@doc.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@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