diff options
author | Pedro Alves <palves@redhat.com> | 2011-02-14 11:10:53 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-02-14 11:10:53 +0000 |
commit | 4e07d55ffbd3d926ab776b2ce3fd13e96d214269 (patch) | |
tree | 3760a8a1660d71a45eaa57121fa577baa79b4115 /gdb/valprint.c | |
parent | 498cd2a0fdc89ee9a81ce4ad0019d64a1f6dbcd7 (diff) | |
download | gdb-4e07d55ffbd3d926ab776b2ce3fd13e96d214269.zip gdb-4e07d55ffbd3d926ab776b2ce3fd13e96d214269.tar.gz gdb-4e07d55ffbd3d926ab776b2ce3fd13e96d214269.tar.bz2 |
Base support for <unavailable> value contents.
gdb/
* value.h (value_bytes_available): Declare.
(mark_value_bytes_unavailable): Declare.
* value.c (struct range): New struct.
(range_s): New typedef.
(ranges_overlap): New function.
(range_lessthan): New function.
(ranges_contain_p): New function.
(struct value) <unavailable>: New field.
(value_bytes_available): New function.
(mark_value_bytes_unavailable): New function.
(require_not_optimized_out): Constify parameter.
(require_available): New function.
(value_contents_all, value_contents): Require all bytes be
available.
(value_free): Free `unavailable'.
(value_copy): Copy `unavailable'.
* valprint.h (val_print_unavailable): Declare.
* valprint.c (valprint_check_validity): Rename `offset' parameter
to `embedded_offset'. If printing a scalar, check whether the
value chunk is available.
(val_print_unavailable): New.
(val_print_scalar_formatted): Check whether the value is
available.
* python/py-prettyprint.c (apply_val_pretty_printer): Refuse
pretty-printing unavailable values.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index b32d6fc..64a4b05 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -260,7 +260,7 @@ scalar_type_p (struct type *type) static int valprint_check_validity (struct ui_file *stream, struct type *type, - int offset, + int embedded_offset, const struct value *val) { CHECK_TYPEDEF (type); @@ -269,19 +269,25 @@ valprint_check_validity (struct ui_file *stream, && TYPE_CODE (type) != TYPE_CODE_STRUCT && TYPE_CODE (type) != TYPE_CODE_ARRAY) { - if (! value_bits_valid (val, TARGET_CHAR_BIT * offset, - TARGET_CHAR_BIT * TYPE_LENGTH (type))) + if (!value_bits_valid (val, TARGET_CHAR_BIT * embedded_offset, + TARGET_CHAR_BIT * TYPE_LENGTH (type))) { val_print_optimized_out (stream); return 0; } - if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * offset, + if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset, TARGET_CHAR_BIT * TYPE_LENGTH (type))) { fputs_filtered (_("<synthetic pointer>"), stream); return 0; } + + if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type))) + { + val_print_unavailable (stream); + return 0; + } } return 1; @@ -293,6 +299,12 @@ val_print_optimized_out (struct ui_file *stream) fprintf_filtered (stream, _("<optimized out>")); } +void +val_print_unavailable (struct ui_file *stream) +{ + fprintf_filtered (stream, _("<unavailable>")); +} + /* Print using the given LANGUAGE the data of type TYPE located at VALADDR + EMBEDDED_OFFSET (within GDB), which came from the inferior at address ADDRESS + EMBEDDED_OFFSET, onto stdio stream @@ -560,6 +572,8 @@ val_print_scalar_formatted (struct type *type, if (!value_bits_valid (val, TARGET_CHAR_BIT * embedded_offset, TARGET_CHAR_BIT * TYPE_LENGTH (type))) val_print_optimized_out (stream); + else if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type))) + val_print_unavailable (stream); else print_scalar_formatted (valaddr + embedded_offset, type, options, size, stream); |