X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fcp-valprint.c;h=2d366b9b182fd890604b0363f3befc7718614166;hb=e1402065ee37ec094d31ccf08fe32efc8df679f1;hp=23f47cda35c4bbaf4fc478ef49ca59b1175d4dc7;hpb=28e7fd62340426746f9c896cbc40c5d374ec47aa;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 23f47cda35..2d366b9b18 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -1,6 +1,6 @@ /* Support for printing C++ values for GDB, the GNU debugger. - Copyright (C) 1986-2013 Free Software Foundation, Inc. + Copyright (C) 1986-2014 Free Software Foundation, Inc. This file is part of GDB. @@ -27,14 +27,14 @@ #include "gdbcmd.h" #include "demangle.h" #include "annotate.h" -#include "gdb_string.h" +#include #include "c-lang.h" #include "target.h" #include "cp-abi.h" #include "valprint.h" #include "cp-support.h" #include "language.h" -#include "python/python.h" +#include "extension.h" #include "exceptions.h" #include "typeprint.h" @@ -239,7 +239,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, fprintf_filtered (stream, ", "); else if (n_baseclasses > 0) { - if (options->pretty) + if (options->prettyformat) { fprintf_filtered (stream, "\n"); print_spaces_filtered (2 + 2 * recurse, stream); @@ -250,7 +250,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, } fields_seen = 1; - if (options->pretty) + if (options->prettyformat) { fprintf_filtered (stream, "\n"); print_spaces_filtered (2 + 2 * recurse, stream); @@ -259,42 +259,21 @@ cp_print_value_fields (struct type *type, struct type *real_type, { wrap_here (n_spaces (2 + 2 * recurse)); } - if (options->inspect_it) - { - if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR) - fputs_filtered ("\"( ptr \"", stream); - else - fputs_filtered ("\"( nodef \"", stream); - if (field_is_static (&TYPE_FIELD (type, i))) - fputs_filtered ("static ", stream); - fprintf_symbol_filtered (stream, - TYPE_FIELD_NAME (type, i), - current_language->la_language, - DMGL_PARAMS | DMGL_ANSI); - fputs_filtered ("\" \"", stream); - fprintf_symbol_filtered (stream, - TYPE_FIELD_NAME (type, i), - current_language->la_language, - DMGL_PARAMS | DMGL_ANSI); - fputs_filtered ("\") \"", stream); - } - else - { - annotate_field_begin (TYPE_FIELD_TYPE (type, i)); - - if (field_is_static (&TYPE_FIELD (type, i))) - fputs_filtered ("static ", stream); - fprintf_symbol_filtered (stream, - TYPE_FIELD_NAME (type, i), - current_language->la_language, - DMGL_PARAMS | DMGL_ANSI); - annotate_field_name_end (); - /* Do not print leading '=' in case of anonymous - unions. */ - if (strcmp (TYPE_FIELD_NAME (type, i), "")) - fputs_filtered (" = ", stream); - annotate_field_value (); - } + + annotate_field_begin (TYPE_FIELD_TYPE (type, i)); + + if (field_is_static (&TYPE_FIELD (type, i))) + fputs_filtered ("static ", stream); + fprintf_symbol_filtered (stream, + TYPE_FIELD_NAME (type, i), + current_language->la_language, + DMGL_PARAMS | DMGL_ANSI); + annotate_field_name_end (); + /* Do not print leading '=' in case of anonymous + unions. */ + if (strcmp (TYPE_FIELD_NAME (type, i), "")) + fputs_filtered (" = ", stream); + annotate_field_value (); if (!field_is_static (&TYPE_FIELD (type, i)) && TYPE_FIELD_PACKED (type, i)) @@ -319,7 +298,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, TYPE_FIELD_BITPOS (type, i), TYPE_FIELD_BITSIZE (type, i))) { - val_print_optimized_out (stream); + val_print_optimized_out (val, stream); } else { @@ -354,12 +333,9 @@ cp_print_value_fields (struct type *type, struct type *real_type, fprintf_filtered (stream, _(""), ex.message); - else if (v == NULL) - val_print_optimized_out (stream); - else - cp_print_static_field (TYPE_FIELD_TYPE (type, i), - v, stream, recurse + 1, - options); + cp_print_static_field (TYPE_FIELD_TYPE (type, i), + v, stream, recurse + 1, + options); } else if (i == vptr_fieldno && type == vptr_basetype) { @@ -428,7 +404,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, } } - if (options->pretty) + if (options->prettyformat) { fprintf_filtered (stream, "\n"); print_spaces_filtered (2 * recurse, stream); @@ -589,7 +565,7 @@ cp_print_value (struct type *type, struct type *real_type, } /* Now do the printing. */ - if (options->pretty) + if (options->prettyformat) { fprintf_filtered (stream, "\n"); print_spaces_filtered (2 * recurse, stream); @@ -608,17 +584,17 @@ cp_print_value (struct type *type, struct type *real_type, { int result = 0; - /* Attempt to run the Python pretty-printers on the + /* Attempt to run an extension language pretty-printer on the baseclass if possible. */ if (!options->raw) - result = apply_val_pretty_printer (baseclass, base_valaddr, - thisoffset + boffset, - value_address (base_val), - stream, recurse, base_val, - options, current_language); + result + = apply_ext_lang_val_pretty_printer (baseclass, base_valaddr, + thisoffset + boffset, + value_address (base_val), + stream, recurse, + base_val, options, + current_language); - - if (!result) cp_print_value_fields (baseclass, thistype, base_valaddr, thisoffset + boffset, @@ -661,7 +637,13 @@ cp_print_static_field (struct type *type, const struct value_print_options *options) { struct value_print_options opts; - + + if (value_entirely_optimized_out (val)) + { + val_print_optimized_out (val, stream); + return; + } + if (TYPE_CODE (type) == TYPE_CODE_STRUCT) { CORE_ADDR *first_dont_print; @@ -789,7 +771,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type, print it. */ struct type *domain = TYPE_DOMAIN_TYPE (type); LONGEST val; - unsigned int fieldno; + int fieldno; val = extract_signed_integer (valaddr, TYPE_LENGTH (type),