static int
valprint_check_validity (struct ui_file *stream,
struct type *type,
- int offset,
+ int embedded_offset,
const struct value *val)
{
CHECK_TYPEDEF (type);
&& 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;
fprintf_filtered (stream, _("<optimized out>"));
}
+void
+val_print_unavailable (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<unavailable>"));
+}
+
+void
+val_print_invalid_address (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<invalid address>"));
+}
+
/* 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
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);
rep1 = i + 1;
reps = 1;
- while (rep1 < len
- && memcmp (valaddr + embedded_offset + i * eltlen,
- valaddr + embedded_offset + rep1 * eltlen,
- eltlen) == 0)
+ /* Only check for reps if repeat_count_threshold is not set to
+ UINT_MAX (unlimited). */
+ if (options->repeat_count_threshold < UINT_MAX)
{
- ++reps;
- ++rep1;
+ while (rep1 < len
+ && value_available_contents_eq (val,
+ embedded_offset + i * eltlen,
+ val,
+ (embedded_offset
+ + rep1 * eltlen),
+ eltlen))
+ {
+ ++reps;
+ ++rep1;
+ }
}
if (reps > options->repeat_count_threshold)