Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Matt Rice <ratmice@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Be in language c more c++ compatible
Date: Sun, 24 Jul 2011 15:59:00 -0000	[thread overview]
Message-ID: <20110724125222.GA8403@host1.jankratochvil.net> (raw)
In-Reply-To: <CACTLOFrQSr3AsYCsEpEB1rHmpxu8vRJeaMO62iYVY4KZpd=T1A@mail.gmail.com>

On Sat, 23 Jul 2011 23:17:43 +0200, Matt Rice wrote:
> was curious what it did with the attached objc++ version.
> 
> which isn't really a supported language by any means.
> gdb considers it to be 'minimal'/doesn't recognize the CU language in
> the debuginfo.

dwarf2read.c:set_cu_language does not recognize DW_LANG_ObjC_plus_plus.


> gcc -g -o objcxx objc++.mm -lobjc
[...]
> (gdb) set language c++
> (gdb) whatis C::t
> A syntax error in expression, near `'.

the problem is the CU (Compilation Unit) is neither Java nor C++ and it even
has no DW_AT_MIPS_linkage_name, therefore `C::C' constructor gets symbol name
`C' which just cannot work.

There probably needs to be created new language_objcplus and adjust the code
accordingly.

I think this is outside of the scope of this thread.


Thanks,
Jan


--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5019,7 +5019,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
   /* These are the only languages we know how to qualify names in.  */
   if (name != NULL
       && (cu->language == language_cplus || cu->language == language_java
-	  || cu->language == language_fortran))
+	  || cu->language == language_fortran || cu->language == language_objc))
     {
       if (die_needs_namespace (die, cu))
 	{
@@ -5061,7 +5061,8 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
 	     templates; two instantiated function templates are allowed to
 	     differ only by their return types, which we do not add here.  */
 
-	  if (cu->language == language_cplus && strchr (name, '<') == NULL)
+	  if ((cu->language == language_cplus || cu->language == language_objc)
+	      && strchr (name, '<') == NULL)
 	    {
 	      struct attribute *attr;
 	      struct die_info *child;
@@ -5171,7 +5172,8 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
 
 	  if (physname && die->tag == DW_TAG_subprogram
 	      && (cu->language == language_cplus
-		  || cu->language == language_java))
+		  || cu->language == language_java
+		  || cu->language == language_objc))
 	    {
 	      struct type *type = read_type_die (die, cu);
 
@@ -5205,7 +5207,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
 				       &length);
 	  ui_file_delete (buf);
 
-	  if (cu->language == language_cplus)
+	  if (cu->language == language_cplus || cu->language == language_objc)
 	    {
 	      char *cname
 		= dwarf2_canonicalize_name (name, cu,
@@ -10399,6 +10401,7 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
       cu->language = language_pascal;
       break;
     case DW_LANG_ObjC:
+    case DW_LANG_ObjC_plus_plus:
       cu->language = language_objc;
       break;
     case DW_LANG_Cobol74:


  reply	other threads:[~2011-07-24 12:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15 20:47 Jan Kratochvil
2011-07-16  8:42 ` Tom Tromey
2011-07-16  9:45   ` Jan Kratochvil
2011-07-23 21:17 ` Mark Kettenis
2011-07-23 21:38   ` Jan Kratochvil
2011-07-25 15:00   ` Tom Tromey
2011-07-23 22:12 ` Matt Rice
2011-07-24 15:59   ` Jan Kratochvil [this message]
2011-07-24 15:59     ` Matt Rice
2011-07-25 14:52       ` Tom Tromey

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=20110724125222.GA8403@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ratmice@gmail.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