This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Obvious fix in values.c?


Do folks agree that this falls under the obvious fix rule?  It doesn't 
seem safe to assume that all demangled names will contain a space (and 
in fact, gdb crashed on someone when the assumption was proved false...).

2002-04-19  Jim Ingham <jingham@apple.com>

	* values.c (value_headof): Don't assume all demangled names contain 
a space.

Index: values.c
===================================================================
RCS file: /cvs/src/src/gdb/values.c,v
retrieving revision 1.34
diff -p -r1.34 values.c
*** values.c    29 Jan 2002 03:08:26 -0000      1.34
--- values.c    19 Apr 2002 21:24:45 -0000
*************** value_headof (struct value *in_arg, stru
*** 1043,1048 ****
--- 1043,1049 ----
     struct symbol *sym;
     char *demangled_name;
     struct minimal_symbol *msymbol;
+   char *tmp;

     btype = TYPE_VPTR_BASETYPE (dtype);
     CHECK_TYPEDEF (btype);
*************** value_headof (struct value *in_arg, stru
*** 1080,1086 ****
           return in_arg;
         }
     demangled_name = cplus_demangle(demangled_name,DMGL_ANSI);
!   *(strchr (demangled_name, ' ')) = '\0';

     sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
     if (sym == NULL)
--- 1081,1089 ----
           return in_arg;
         }
     demangled_name = cplus_demangle(demangled_name,DMGL_ANSI);
!   tmp = strchr (demangled_name, ' ');
!   if (tmp)
!     *tmp = '\0';

     sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
     if (sym == NULL)

--
Jim Ingham                                   jingham@apple.com
Developer Tools - gdb
Apple Computer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]