From 36a2283dad09124b2d980d10adfca84d31aaedcb Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Thu, 5 May 1994 00:19:33 +0000 Subject: Add partial support for g++ code compiled with -fvtable-thunks. * c-valprint.c (c_val_print): Add vtblprint support when using thunks. * cp-valprint.c (cp_is_vtbl_member): A vtable can be an array of pointers (if using thunks) as well as array of structs (otherwise). * cp-valprint.c (vtbl_ptr_name_old, vtbl_ptr_name): Move to global level, and make the latter non-static (so define_symbol can use it). * stabsread.c (define_symbol): If the type being defined is a pointer type named "__vtbl_ptr_type", set the TYPE_NAME to that name. * symtab.h (VTBL_PREFIX_P): Allow "_VT" as well as "_vt". * values.c (value_virtual_fn_field): Handle thunks. * values.c (value_headof): Minor efficiency hack. * values.c (value_headof): Incomplete thunk support. FIXME. --- gdb/c-valprint.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gdb/c-valprint.c') diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 0eb3133..cea6889 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -146,6 +146,15 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse, print_scalar_formatted (valaddr, type, format, 0, stream); break; } + if (vtblprint && cp_is_vtbl_ptr_type(type)) + { + /* Print the unmangled name if desired. */ + /* Print vtable entry - we only get here if we ARE using + -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */ + print_address_demangle(extract_address (valaddr, TYPE_LENGTH (type)), + stream, demangle); + break; + } if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) { cp_print_class_method (valaddr, type, stream); @@ -290,6 +299,8 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse, if (vtblprint && cp_is_vtbl_ptr_type(type)) { /* Print the unmangled name if desired. */ + /* Print vtable entry - we only get here if NOT using + -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */ print_address_demangle(*((int *) (valaddr + /* FIXME bytesex */ TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8)), stream, demangle); -- cgit v1.1