&& type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_ARRAY)
{
- if (value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * type->length ()))
+ if (val->bits_any_optimized_out (TARGET_CHAR_BIT * embedded_offset,
+ TARGET_CHAR_BIT * type->length ()))
{
val_print_optimized_out (val, stream);
return 0;
return is_ref;
}
- if (!value_bytes_available (val, embedded_offset, type->length ()))
+ if (!val->bytes_available (embedded_offset, type->length ()))
{
val_print_unavailable (stream);
return 0;
{
struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL;
- const int value_is_synthetic
+ const bool value_is_synthetic
= original_value->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * type->length ());
const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
type->fixed_point_scaling_factor ());
const char *fmt = type->length () < 4 ? "%.11Fg" : "%.17Fg";
- std::string str = gmp_string_printf (fmt, f.val);
+ std::string str = f.str (fmt);
gdb_printf (stream, "%s", str.c_str ());
}
}
return 0;
}
- if (value_entirely_optimized_out (val))
+ if (val->entirely_optimized_out ())
{
if (options->summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
return 0;
}
- if (value_entirely_unavailable (val))
+ if (val->entirely_unavailable ())
{
if (options->summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
/* A scalar object that does not have all bits available can't be
printed, because all bits contribute to its representation. */
- if (value_bits_any_optimized_out (val, 0,
- TARGET_CHAR_BIT * type->length ()))
+ if (val->bits_any_optimized_out (0,
+ TARGET_CHAR_BIT * type->length ()))
val_print_optimized_out (val, stream);
- else if (!value_bytes_available (val, 0, type->length ()))
+ else if (!val->bytes_available (0, type->length ()))
val_print_unavailable (stream);
else
print_scalar_formatted (valaddr, type, options, size, stream);
maybe_print_array_index (index_type, i + low_bound,
stream, options);
- struct value *element = value_from_component_bitsize (val, elttype,
- bit_stride * i,
- bit_stride);
+ struct value *element = val->from_component_bitsize (elttype,
+ bit_stride * i,
+ bit_stride);
rep1 = i + 1;
reps = 1;
/* Only check for reps if repeat_count_threshold is not set to
UINT_MAX (unlimited). */
if (options->repeat_count_threshold < UINT_MAX)
{
- bool unavailable = value_entirely_unavailable (element);
- bool available = value_entirely_available (element);
+ bool unavailable = element->entirely_unavailable ();
+ bool available = element->entirely_available ();
while (rep1 < len)
{
struct value *rep_elt
- = value_from_component_bitsize (val, elttype,
- rep1 * bit_stride,
- bit_stride);
+ = val->from_component_bitsize (elttype,
+ rep1 * bit_stride,
+ bit_stride);
bool repeated = ((available
- && value_entirely_available (rep_elt)
+ && rep_elt->entirely_available ()
&& element->contents_eq (rep_elt))
|| (unavailable
- && value_entirely_unavailable (rep_elt)));
+ && rep_elt->entirely_unavailable ()));
if (!repeated)
break;
++reps;
/* Print the characters in CHARS to the OBSTACK. QUOTE_CHAR is the quote
character to use with string output. WIDTH is the size of the output
character type. BYTE_ORDER is the target byte order. OPTIONS
- is the user's print options. */
+ is the user's print options. *FINISHED is set to 0 if we didn't print
+ all the elements in CHARS. */
static void
print_converted_chars_to_obstack (struct obstack *obstack,
const std::vector<converted_character> &chars,
int quote_char, int width,
enum bfd_endian byte_order,
- const struct value_print_options *options)
+ const struct value_print_options *options,
+ int *finished)
{
- unsigned int idx;
+ unsigned int idx, num_elements;
const converted_character *elem;
enum {START, SINGLE, REPEAT, INCOMPLETE, FINISH} state, last;
gdb_wchar_t wide_quote_char = gdb_btowc (quote_char);
bool need_escape = false;
+ const int print_max = options->print_max_chars > 0
+ ? options->print_max_chars : options->print_max;
/* Set the start state. */
- idx = 0;
+ idx = num_elements = 0;
last = state = START;
elem = NULL;
obstack_grow (obstack, &wide_quote_char, sizeof (gdb_wchar_t));
}
/* Output the character. */
- for (j = 0; j < elem->repeat_count; ++j)
+ int repeat_count = elem->repeat_count;
+ if (print_max < repeat_count + num_elements)
+ {
+ repeat_count = print_max - num_elements;
+ *finished = 0;
+ }
+ for (j = 0; j < repeat_count; ++j)
{
if (elem->result == wchar_iterate_ok)
print_wchar (elem->chars[0], elem->buf, elem->buflen, width,
else
print_wchar (gdb_WEOF, elem->buf, elem->buflen, width,
byte_order, obstack, quote_char, &need_escape);
+ num_elements += 1;
}
}
break;
obstack_grow_wstr (obstack, LCST ("'"));
std::string s = string_printf (_(" <repeats %u times>"),
elem->repeat_count);
+ num_elements += elem->repeat_count;
for (j = 0; s[j]; ++j)
{
gdb_wchar_t w = gdb_btowc (s[j]);
print_wchar (gdb_WEOF, elem->buf, elem->buflen, width, byte_order,
obstack, 0, &need_escape);
obstack_grow_wstr (obstack, LCST (">"));
+ num_elements += 1;
/* We do not attempt to output anything after this. */
state = FINISH;
/* Print the output string to the obstack. */
print_converted_chars_to_obstack (&wchar_buf, converted_chars, quote_char,
- width, byte_order, options);
+ width, byte_order, options, &finished);
if (force_ellipses || !finished)
obstack_grow_wstr (&wchar_buf, LCST ("..."));