diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index a96a81a..efc13e5 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -36,6 +36,7 @@ #include "valprint.h" #include "cp-support.h" #include "language.h" +#include "python/python.h" /* Controls printing of vtbl's */ static void @@ -155,16 +156,33 @@ cp_print_value_fields (struct type *type, struct type *real_type, int i, len, n_baseclasses; char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack); int fields_seen = 0; + int result = 0; + struct type *baseclass; CHECK_TYPEDEF (type); - fprintf_filtered (stream, "{"); len = TYPE_NFIELDS (type); n_baseclasses = TYPE_N_BASECLASSES (type); + /* Attempt to run the Python pretty-printers on the base class of + the derived class. */ + if (!options->raw) + if (n_baseclasses > 0) + { + + baseclass = check_typedef (TYPE_BASECLASS (type,0)); + result = apply_val_pretty_printer (baseclass, valaddr, offset, + address, stream, recurse, options, + current_language); + + if (result) + return; + } + /* First, print out baseclasses such that we don't print duplicates of virtual baseclasses. */ + fprintf_filtered (stream, "{"); if (n_baseclasses > 0) cp_print_value (type, real_type, valaddr, offset, address, stream, recurse + 1, options, dont_print_vb);