summaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-05-28 01:05:13 +0000
committerTom Tromey <tromey@redhat.com>2009-05-28 01:05:13 +0000
commit00098a51f15b9c5fdbb02aeee3817dd656dfa741 (patch)
treed4e7770896de1fcf3081d4262d6d6b0aa30bf601 /gdb/cp-valprint.c
parent6b07559d667d8a8c4392b0152bee496060d85a42 (diff)
downloadgdb-00098a51f15b9c5fdbb02aeee3817dd656dfa741.tar.gz
gdb
2009-05-27 Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> Phil Muldoon <pmuldoon@redhat.com> Paul Pluzhnikov <ppluzhnikov@google.com> Vladimir Prus <vladimir@codesourcery.com> * python/python-value.c (value_object_to_value): New function. * python/python-internal.h: Include frameobject.h. (gdbpy_children_cst, gdbpy_to_string_cst, gdbpy_display_hint_cst): Declare. (value_object_to_value): Declare. * printcmd.c (struct format_data) <raw>: New field. (last_format): Default to 0. (decode_format): Initialize val.raw. Handle /r flag. (print_command_1): Initialize fmt.raw and opts.raw. (output_command): Likewise. (x_command): Fix initialization of fmt.format. Initialize fmt.raw. (display_command): Initialize fmt.raw. (do_one_display): Set opts.raw. * python/python.c (gdbpy_to_string_cst, gdbpy_children_cst, gdbpy_display_hint_cst): New globals. (_initialize_python): Initialize them. Set gdb.pretty_printers. * cp-valprint.c: Include python.h. (cp_print_value): Call apply_val_pretty_printer. * python/python.h (apply_val_pretty_printer): Declare. * stack.c (print_this_frame_argument_p): Remove. (print_frame_args): Compute summary flag. Don't use print_this_frame_argument_p. * valprint.c: Include python.h. (user_print_options): Initialize new fields. (scalar_type_p): New function. (val_print): Handle 'raw' and 'summary' modes. Call apply_val_pretty_printer. (value_print): Handle 'raw' mode. * valprint.h (struct value_print_options) <raw, summary>: New fields. * Makefile.in (SUBDIR_PYTHON_OBS): Add python-prettyprint.o (SUBDIR_PYTHON_SRCS): Add python-prettyprint.c. (python-prettyprint.o): New target. * python/python-prettyprint.c: New file. gdb/doc 2009-05-27 Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Objfiles In Python): Reference pretty printing. (Pretty Printing): New node. (Selecting Pretty-Printers): Likewise. (Python API): Update. (Output Formats): Document /r format. gdb/testsuite 2009-05-27 Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> Phil Muldoon <pmuldoon@redhat.com> Paul Pluzhnikov <ppluzhnikov@google.com> * gdb.python/python-prettyprint.exp: New file. * gdb.python/python-prettyprint.c: New file. * gdb.python/python-prettyprint.py: New file. * gdb.base/display.exp: print/r is now valid.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 181b4ffb5b8..d264b40e25b 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
@@ -418,12 +419,27 @@ cp_print_value (struct type *type, struct type *real_type,
if (skip >= 1)
fprintf_filtered (stream, "<invalid address>");
else
- cp_print_value_fields (baseclass, thistype, base_valaddr,
- thisoffset + boffset, address + boffset,
- stream, recurse, options,
- ((struct type **)
- obstack_base (&dont_print_vb_obstack)),
- 0);
+ {
+ int result = 0;
+
+ /* Attempt to run the Python pretty-printers on the
+ baseclass if possible. */
+ if (!options->raw)
+ result = apply_val_pretty_printer (baseclass, base_valaddr,
+ thisoffset + boffset,
+ address + boffset,
+ stream, recurse,
+ options,
+ current_language);
+
+ if (!result)
+ cp_print_value_fields (baseclass, thistype, base_valaddr,
+ thisoffset + boffset, address + boffset,
+ stream, recurse, options,
+ ((struct type **)
+ obstack_base (&dont_print_vb_obstack)),
+ 0);
+ }
fputs_filtered (", ", stream);
flush_it: