+2012-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * cp-valprint.c (cp_print_value_fields): Check valprint_check_validity
+ for TYPE_VPTR_FIELDNO.
+ * valprint.c (valprint_check_validity): Make it global, move the
+ function comment ...
+ * value.h (valprint_check_validity): ... to this new declaration.
+
2012-04-02 Tristan Gingold <gingold@adacore.com>
* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Use
}
else if (i == TYPE_VPTR_FIELDNO (type))
{
- CORE_ADDR addr
- = extract_typed_address (valaddr + offset
- + TYPE_FIELD_BITSIZE (type, i) / 8,
- TYPE_FIELD_TYPE (type, i));
-
- print_function_pointer_address (get_type_arch (type),
- addr, stream,
- options->addressprint);
+ int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+ struct type *i_type = TYPE_FIELD_TYPE (type, i);
+
+ if (valprint_check_validity (stream, i_type, i_offset, val))
+ {
+ CORE_ADDR addr;
+
+ addr = extract_typed_address (valaddr + i_offset, i_type);
+ print_function_pointer_address (get_type_arch (type),
+ addr, stream,
+ options->addressprint);
+ }
}
else
{
+2012-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.trace/unavailable.exp
+ (collect globals: print object on: print derived_partial)
+ (collect globals: print object on: print derived_whole)
+ (collect globals: print object off: print derived_partial)
+ (collect globals: print object off: print derived_whole): Update
+ expected output.
+
2012-03-30 Keith Seitz <keiths@redhat.com>
* gdb.python: Add test for linespecs with commas.
# vtable pointer available, but nothing else
gdb_test "print derived_partial" \
- " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex, z = <unavailable>}"
+ " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
# whole object available
gdb_test "print derived_whole" \
- " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}"
+ " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
}
gdb_test_no_output "set print object off"
# vtable pointer available, but nothing else
gdb_test "print derived_partial" \
- " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex, z = <unavailable>}"
+ " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
# whole object available
gdb_test "print derived_whole" \
- " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}"
+ " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
}
# An instance of a virtual class where we collected everything but
}
}
-/* Helper function to check the validity of some bits of a value.
+/* See its definition in value.h. */
- If TYPE represents some aggregate type (e.g., a structure), return 1.
-
- Otherwise, any of the bytes starting at OFFSET and extending for
- TYPE_LENGTH(TYPE) bytes are invalid, print a message to STREAM and
- return 0. The checking is done using FUNCS.
-
- Otherwise, return 1. */
-
-static int
+int
valprint_check_validity (struct ui_file *stream,
struct type *type,
int embedded_offset,
const struct lval_funcs *funcs,
void *closure);
+/* Helper function to check the validity of some bits of a value.
+
+ If TYPE represents some aggregate type (e.g., a structure), return 1.
+
+ Otherwise, any of the bytes starting at OFFSET and extending for
+ TYPE_LENGTH(TYPE) bytes are invalid, print a message to STREAM and
+ return 0. The checking is done using FUNCS.
+
+ Otherwise, return 1. */
+
+extern int valprint_check_validity (struct ui_file *stream, struct type *type,
+ int embedded_offset,
+ const struct value *val);
+
extern struct value *allocate_optimized_out_value (struct type *type);
/* If VALUE is lval_computed, return its lval_funcs structure. */