aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-12-10 12:00:30 -0800
committerDoug Evans <dje@google.com>2015-12-10 12:00:30 -0800
commitb8f344199d9d4cc8ac27a956037d38ef0d848b8a (patch)
treec7e5ce761cb2b2667858363573515799ffed9f87
parentec5063d304949040e577d0378bc4d8c5ca65790b (diff)
downloadfsf-binutils-gdb-b8f344199d9d4cc8ac27a956037d38ef0d848b8a.zip
fsf-binutils-gdb-b8f344199d9d4cc8ac27a956037d38ef0d848b8a.tar.gz
fsf-binutils-gdb-b8f344199d9d4cc8ac27a956037d38ef0d848b8a.tar.bz2
patch ../102426902.patch
-rw-r--r--README.google12
-rw-r--r--gdb/symtab.c13
-rw-r--r--gdb/typeprint.c54
-rw-r--r--gdb/typeprint.h7
4 files changed, 81 insertions, 5 deletions
diff --git a/README.google b/README.google
index e197a59..d26e0a7 100644
--- a/README.google
+++ b/README.google
@@ -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.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7d3b228..b5cd198 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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");
}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 5a97ace..64ff8aa 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -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. */
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index bdff41b..04e616b 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -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