This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Be in language c more c++ compatible
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: