* valprint.c (type_print_1): Plug memory leak. Print all
authorFred Fish <fnf@specifix.com>
Fri, 19 Jun 1992 02:43:22 +0000 (02:43 +0000)
committerFred Fish <fnf@specifix.com>
Fri, 19 Jun 1992 02:43:22 +0000 (02:43 +0000)
  C++ syms as demangled, not just functions.
  * buildsym.c (read_range_type):  When we find a signed char
  type, do a lookup of signed char, not plain char.  Plain char's
  still get looked up as plain char's elsewhere.

gdb/ChangeLog
gdb/buildsym.c
gdb/valprint.c

index 7baa2510694413e581cfa4b07431bfa76976fad2..a2ea8340b977e43c0f48612addd8cbf486ab2f19 100644 (file)
@@ -1,3 +1,11 @@
+Thu Jun 18 19:35:22 1992  Fred Fish  (fnf@cygnus.com)
+
+       * valprint.c (type_print_1):  Plug memory leak.  Print all
+       C++ syms as demangled, not just functions.
+       * buildsym.c (read_range_type):  When we find a signed char
+       type, do a lookup of signed char, not plain char.  Plain char's
+       still get looked up as plain char's elsewhere.
+
 Wed Jun 17 13:08:33 1992  Stu Grossman  (grossman at cygnus.com)
 
        * xm-rs6000.h:  Fix decls for malloc, realloc, and free.
index 9af0af65afe453505c2cca9d0979bb15b012817e..24552edf803cffe3128f94f6354057c27bcf27b9 100644 (file)
@@ -3344,7 +3344,7 @@ read_range_type (pp, typenums, objfile)
       if (n3 ==        (               1 << (8 * sizeof (short) - 1)) - 1)
        return (lookup_fundamental_type (objfile, FT_SHORT));
       if (n3 ==        (               1 << (8 * sizeof (char)  - 1)) - 1)
-       return (lookup_fundamental_type (objfile, FT_CHAR));
+       return (lookup_fundamental_type (objfile, FT_SIGNED_CHAR));
     }
 
   /* We have a real range type on our hands.  Allocate space and
index c4ea66725fd4a41ec925e2a3345b9de85e0f1e20..80d843acf11684be51c8eb9c8cb68768d54970ad 100644 (file)
@@ -1350,7 +1350,8 @@ type_print_1 (type, varstring, stream, show, level)
      int level;
 {
   register enum type_code code;
-  char *demangled;
+  char *demangled = NULL;
+  int demangled_args;
 
   type_print_base (type, stream, show, level);
   code = TYPE_CODE (type);
@@ -1367,23 +1368,26 @@ type_print_1 (type, varstring, stream, show, level)
        || code == TYPE_CODE_REF)))
     fprintf_filtered (stream, " ");
   type_print_varspec_prefix (type, stream, show, 0);
+
+  /* See if the name has a C++ demangled equivalent, and if so, print that
+     instead. */
+
   if (demangle)
     {
       demangled = cplus_demangle (varstring, DMGL_ANSI | DMGL_PARAMS);
     }
-  if ((demangled != NULL) && (code == TYPE_CODE_FUNC))
+  fputs_filtered ((demangled != NULL) ? demangled : varstring, stream);
+
+  /* For demangled function names, we have the arglist as part of the name,
+     so don't print an additional pair of ()'s */
+
+  demangled_args = (demangled != NULL) && (code == TYPE_CODE_FUNC);
+  type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+
+  if (demangled)
     {
-      /* For demangled function names, we have the arglist as part
-        of the name, so don't print an additional pair of ()'s */
-      fputs_filtered (demangled, stream);
-      type_print_varspec_suffix (type, stream, show, 0, 1);
       free (demangled);
     }
-  else
-    {
-      fputs_filtered (varstring, stream);
-      type_print_varspec_suffix (type, stream, show, 0, 0);
-    }
 }
 
 /* Print the method arguments ARGS to the file STREAM.  */
@@ -1681,6 +1685,8 @@ type_print_base (type, stream, show, level)
   register int i;
   register int len;
   register int lastval;
+  char *mangled_name;
+  char *demangled_name;
 
   QUIT;
 
@@ -1809,11 +1815,11 @@ type_print_base (type, stream, show, level)
                  if (TYPE_FN_FIELD_STUB (f, j))
                    {
                      /* Build something we can demangle.  */
-                     char *mangled_name = gdb_mangle_name (type, i, j);
-                     char *demangled_name =
+                     mangled_name = gdb_mangle_name (type, i, j);
+                     demangled_name =
                          cplus_demangle (mangled_name,
                                          DMGL_ANSI | DMGL_PARAMS);
-                     if (demangled_name == 0)
+                     if (demangled_name == NULL)
                        fprintf_filtered (stream, "<badly mangled name %s>",
                            mangled_name);
                      else 
This page took 0.031302 seconds and 4 git commands to generate.