binutils-gdb/gdb/gcc.patch

64 lines
2.2 KiB
Diff

Recent versions of gcc have had a bug in how they emit debugging
information for C++ methods (when using dbx-style stabs).
This patch should fix the problem. Fix you can't fix gcc,
you can alternatively define GCC_MANGLE_BUG when compling gdb/symtab.c.
===================================================================
RCS file: /rel/cvsfiles/devo/gcc/dbxout.c,v
retrieving revision 1.53
diff -c -r1.53 dbxout.c
*** 1.53 1992/07/05 09:50:22
--- dbxout.c 1992/07/09 07:00:33
***************
*** 683,688 ****
--- 683,689 ----
tree type_encoding;
register tree fndecl;
register tree last;
+ char formatted_type_identifier_length[16];
register int type_identifier_length;
if (methods == NULL_TREE)
***************
*** 711,716 ****
--- 712,719 ----
type_identifier_length = IDENTIFIER_LENGTH (type_encoding);
+ sprintf(formatted_type_identifier_length, "%d", type_identifier_length);
+
if (TREE_CODE (methods) == FUNCTION_DECL)
fndecl = methods;
else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
***************
*** 754,762 ****
--- 757,769 ----
if (debug_name[0] == '_' && debug_name[1] == '_')
{
char *method_name = debug_name + 2;
+ char *length_ptr = formatted_type_identifier_length;
/* Get past const and volatile qualifiers. */
while (*method_name == 'C' || *method_name == 'V')
method_name++;
+ /* Skip digits for length of type_encoding. */
+ while (*method_name == *length_ptr && *length_ptr)
+ length_ptr++, method_name++;
if (! strncmp (method_name,
IDENTIFIER_POINTER (type_encoding),
type_identifier_length))
***************
*** 768,775 ****
--- 775,786 ----
else if (debug_name[0] == '_' && debug_name[1] == '_')
{
char *ctor_name = debug_name + 2;
+ char *length_ptr = formatted_type_identifier_length;
while (*ctor_name == 'C' || *ctor_name == 'V')
ctor_name++;
+ /* Skip digits for length of type_encoding. */
+ while (*ctor_name == *length_ptr && *length_ptr)
+ length_ptr++, ctor_name++;
if (!strncmp (IDENTIFIER_POINTER (type_encoding), ctor_name,
type_identifier_length))
debug_name = ctor_name + type_identifier_length;