| 1 | Recent versions of gcc have had a bug in how they emit debugging |
| 2 | information for C++ methods (when using dbx-style stabs). |
| 3 | This patch should fix the problem. Fix you can't fix gcc, |
| 4 | you can alternatively define GCC_MANGLE_BUG when compling gdb/symtab.c. |
| 5 | |
| 6 | =================================================================== |
| 7 | RCS file: /rel/cvsfiles/devo/gcc/dbxout.c,v |
| 8 | retrieving revision 1.53 |
| 9 | diff -c -r1.53 dbxout.c |
| 10 | *** 1.53 1992/07/05 09:50:22 |
| 11 | --- dbxout.c 1992/07/09 07:00:33 |
| 12 | *************** |
| 13 | *** 683,688 **** |
| 14 | --- 683,689 ---- |
| 15 | tree type_encoding; |
| 16 | register tree fndecl; |
| 17 | register tree last; |
| 18 | + char formatted_type_identifier_length[16]; |
| 19 | register int type_identifier_length; |
| 20 | |
| 21 | if (methods == NULL_TREE) |
| 22 | *************** |
| 23 | *** 711,716 **** |
| 24 | --- 712,719 ---- |
| 25 | |
| 26 | type_identifier_length = IDENTIFIER_LENGTH (type_encoding); |
| 27 | |
| 28 | + sprintf(formatted_type_identifier_length, "%d", type_identifier_length); |
| 29 | + |
| 30 | if (TREE_CODE (methods) == FUNCTION_DECL) |
| 31 | fndecl = methods; |
| 32 | else if (TREE_VEC_ELT (methods, 0) != NULL_TREE) |
| 33 | *************** |
| 34 | *** 754,762 **** |
| 35 | --- 757,769 ---- |
| 36 | if (debug_name[0] == '_' && debug_name[1] == '_') |
| 37 | { |
| 38 | char *method_name = debug_name + 2; |
| 39 | + char *length_ptr = formatted_type_identifier_length; |
| 40 | /* Get past const and volatile qualifiers. */ |
| 41 | while (*method_name == 'C' || *method_name == 'V') |
| 42 | method_name++; |
| 43 | + /* Skip digits for length of type_encoding. */ |
| 44 | + while (*method_name == *length_ptr && *length_ptr) |
| 45 | + length_ptr++, method_name++; |
| 46 | if (! strncmp (method_name, |
| 47 | IDENTIFIER_POINTER (type_encoding), |
| 48 | type_identifier_length)) |
| 49 | *************** |
| 50 | *** 768,775 **** |
| 51 | --- 775,786 ---- |
| 52 | else if (debug_name[0] == '_' && debug_name[1] == '_') |
| 53 | { |
| 54 | char *ctor_name = debug_name + 2; |
| 55 | + char *length_ptr = formatted_type_identifier_length; |
| 56 | while (*ctor_name == 'C' || *ctor_name == 'V') |
| 57 | ctor_name++; |
| 58 | + /* Skip digits for length of type_encoding. */ |
| 59 | + while (*ctor_name == *length_ptr && *length_ptr) |
| 60 | + length_ptr++, ctor_name++; |
| 61 | if (!strncmp (IDENTIFIER_POINTER (type_encoding), ctor_name, |
| 62 | type_identifier_length)) |
| 63 | debug_name = ctor_name + type_identifier_length; |