aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index cb85b0b..7dd13bb 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -360,14 +360,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
}
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
{