From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17971 invoked by alias); 24 Jul 2011 12:52:43 -0000 Received: (qmail 17963 invoked by uid 22791); 24 Jul 2011 12:52:42 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ,TW_CX,TW_JC X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jul 2011 12:52:27 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6OCqRPW015392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 24 Jul 2011 08:52:27 -0400 Received: from host1.jankratochvil.net (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6OCqPHR005039 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 24 Jul 2011 08:52:27 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p6OCqO5h013596; Sun, 24 Jul 2011 14:52:24 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p6OCqNdA013595; Sun, 24 Jul 2011 14:52:23 +0200 Date: Sun, 24 Jul 2011 15:59:00 -0000 From: Jan Kratochvil To: Matt Rice Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Be in language c more c++ compatible Message-ID: <20110724125222.GA8403@host1.jankratochvil.net> References: <20110715191920.GA29975@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2011-07/txt/msg00664.txt.bz2 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: