return 0;
}
-
-/* Print data of type TYPE located at VALADDR (within GDB), which came
- from the inferior at address ADDRESS, onto stdio stream STREAM
- according to OPTIONS. The data at VALADDR is in target byte order.
-
- If the data are a string pointer, returns the number of string
- characters printed. */
+/* See val_print for a description of the various parameters of this
+ function; they are identical. The semantics of the return value is
+ also identical to val_print. */
int
c_val_print (struct type *type, const gdb_byte *valaddr,
long as the entire array is valid. */
if (c_textual_element_type (unresolved_elttype,
options->format)
+ && value_bytes_available (original_value, embedded_offset,
+ TYPE_LENGTH (type))
&& value_bits_valid (original_value,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
}
/* Array of unspecified length: treat like pointer to first
elt. */
- addr = address;
+ addr = address + embedded_offset;
goto print_unpacked_pointer;
case TYPE_CODE_MEMBERPTR:
}
/* Pointer to class, check real type of object. */
fprintf_filtered (stream, "(");
- real_type = value_rtti_target_type (val, &full,
- &top, &using_enc);
- if (real_type)
- {
- /* RTTI entry found. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- {
- /* Create a pointer type pointing to the real
- type. */
- type = lookup_pointer_type (real_type);
- }
- else
- {
- /* Create a reference type referencing the real
- type. */
- type = lookup_reference_type (real_type);
- }
- /* JYG: Need to adjust pointer value. */
- /* NOTE: cagney/2005-01-02: THIS IS BOGUS. */
- value_contents_writeable (val)[0] -= top;
-
- /* Note: When we look up RTTI entries, we don't get any
- information on const or volatile attributes. */
- }
+
+ if (value_entirely_available (val))
+ {
+ real_type = value_rtti_target_type (val, &full, &top, &using_enc);
+ if (real_type)
+ {
+ /* RTTI entry found. */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ {
+ /* Create a pointer type pointing to the real
+ type. */
+ type = lookup_pointer_type (real_type);
+ }
+ else
+ {
+ /* Create a reference type referencing the real
+ type. */
+ type = lookup_reference_type (real_type);
+ }
+ /* Need to adjust pointer value. */
+ val = value_from_pointer (type, value_as_address (val) - top);
+
+ /* Note: When we look up RTTI entries, we don't get
+ any information on const or volatile
+ attributes. */
+ }
+ }
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
val_type = type;