]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
patch ../102426902.patch
authorDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:30 +0000 (12:00 -0800)
committerDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:30 +0000 (12:00 -0800)
README.google
gdb/symtab.c
gdb/typeprint.c
gdb/typeprint.h

index e197a5975e044fb48434b72069fae027179eb4bd..d26e0a726e3252c46ade50466b6495f8def63fb1 100644 (file)
@@ -94,3 +94,15 @@ they are an ongoing maintenance burden.
 +      (bfd_alloc_aux, bfd_release_all_aux): New functions.
 +      * gdb/elfread.c (elf_symfile_read): Free memory for normal symtab.
 +      * gdb/solib.c (gdb_bfd_lookup_symbol_from_symtab): Ditto.
+--- README.google      2015-09-05 16:13:49.000000000 -0700
++++ README.google      2015-09-05 16:18:05.000000000 -0700
++
++2015-09-05  Doug Evans  <dje@google.com>
++
++      Workaround http://sourceware.org/bugzilla/show_bug.cgi?id=15412
++      * typeprint.c (restore_default_ptype_raw): New function.
++      (symbol_info_type_print, symbol_info_typedef_print): New functions.
++      * typeprint.h (symbol_info_type_print): Declare.
++      (symbol_info_typedef_print): Declare.
++      * symtab.c: #include "typeprint.h".
++      (print_symbol_info): Call them.
index 7d3b228275f525ec96473cf838565c874ee7127b..b5cd1980a266b781b13f421c673f4d1a76d05623 100644 (file)
@@ -24,6 +24,7 @@
 #include "frame.h"
 #include "target.h"
 #include "value.h"
+#include "typeprint.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdbcmd.h"
@@ -4754,19 +4755,21 @@ print_symbol_info (enum search_domain kind,
   if (kind != TYPES_DOMAIN && block == STATIC_BLOCK)
     printf_filtered ("static ");
 
+  // GOOGLE_LOCAL: call symbol_info_type{,def}_print
+
   /* Typedef that is not a C++ class.  */
   if (kind == TYPES_DOMAIN
       && SYMBOL_DOMAIN (sym) != STRUCT_DOMAIN)
-    typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
+    symbol_info_typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
   /* variable, func, or typedef-that-is-c++-class.  */
   else if (kind < TYPES_DOMAIN
           || (kind == TYPES_DOMAIN
               && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN))
     {
-      type_print (SYMBOL_TYPE (sym),
-                 (SYMBOL_CLASS (sym) == LOC_TYPEDEF
-                  ? "" : SYMBOL_PRINT_NAME (sym)),
-                 gdb_stdout, 0);
+      symbol_info_type_print (SYMBOL_TYPE (sym),
+                             (SYMBOL_CLASS (sym) == LOC_TYPEDEF
+                              ? "" : SYMBOL_PRINT_NAME (sym)),
+                             gdb_stdout, 0);
 
       printf_filtered (";\n");
     }
index 5a97acecbea9f04bf936bda196779e63e2ed2282..64ff8aa127579d5cdda6a19070f3f6367258b349 100644 (file)
@@ -363,6 +363,60 @@ type_print (struct type *type, const char *varstring, struct ui_file *stream,
   LA_PRINT_TYPE (type, varstring, stream, show, 0, &default_ptype_flags);
 }
 
+// GOOGLE LOCAL: http://sourceware.org/bugzilla/show_bug.cgi?id=15412
+
+/* Cleanup helper for symbol_info_type_print to restore the raw flag.  */
+
+static void
+restore_default_ptype_raw (void *arg)
+{
+  int *previous = arg;
+
+  default_ptype_flags.raw = *previous;
+}
+
+/* Hacky copy of type_print to set the "raw" flag for print_symbol_info.
+   This is defined here and not symtab.c because we want to change just
+   one flag in default_ptype_flags (which is local to this file).  */
+
+void
+symbol_info_type_print (struct type *type, const char *varstring,
+                       struct ui_file *stream, int show)
+{
+  int previous_raw = default_ptype_flags.raw;
+  struct cleanup *cleanup = make_cleanup (restore_default_ptype_raw,
+                                         &previous_raw);
+
+  default_ptype_flags.raw = 1;
+  LA_PRINT_TYPE (type, varstring, stream, show, 0, &default_ptype_flags);
+  do_cleanups (cleanup);
+}
+
+/* Hacky copy of typedef_print to set the "raw" flag for print_symbol_info.
+   This is defined here and not symtab.c because we want to change just
+   one flag in default_ptype_flags (which is local to this file).  */
+
+void
+symbol_info_typedef_print (struct type *type, struct symbol *new,
+                          struct ui_file *stream)
+{
+  /* NOTE: The type printing API needs to change: LA_PRINT_TYPEDEF
+   doesn't take a type_print_options parameter, yet it calls type_print
+   which hardwires its own flags, and print_symbol_info calls
+   typedef_print.  That is why we can't just make a copy of
+   default_ptype_flags and set the raw flag.  To get all the performance
+   back in a simple and safe way we have to modify default_ptype_flags.  */
+  int previous_raw = default_ptype_flags.raw;
+  struct cleanup *cleanup = make_cleanup (restore_default_ptype_raw,
+                                         &previous_raw);
+
+  default_ptype_flags.raw = 1;
+  LA_PRINT_TYPEDEF (type, new, stream);
+  do_cleanups (cleanup);
+}
+
+// END GOOGLE LOCAL
+
 /* Print TYPE to a string, returning it.  The caller is responsible for
    freeing the string.  */
 
index bdff41bb79026f0f69d9f722b51a705184dea94d..04e616bb3bc6497e91833f85e5ccda59dc727906 100644 (file)
@@ -74,4 +74,11 @@ void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
 void c_type_print_args (struct type *, struct ui_file *, int, enum language,
                        const struct type_print_options *);
 
+// GOOGLE LOCAL
+void symbol_info_type_print (struct type *type, const char *varstring,
+                            struct ui_file *stream, int show);
+void symbol_info_typedef_print (struct type *type, struct symbol *news,
+                               struct ui_file *stream);
+// END GOOGLE LOCAL
+
 #endif