diff options
author | Per Bothner <per@bothner.com> | 1994-05-05 00:19:33 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1994-05-05 00:19:33 +0000 |
commit | 36a2283dad09124b2d980d10adfca84d31aaedcb (patch) | |
tree | 4f5c5c0cfbe4d19d0640f1b50d34372ab24ae551 /gdb/cp-valprint.c | |
parent | d32a92614da2060c30a286d11bfb03146bc8dca6 (diff) | |
download | gdb-36a2283dad09124b2d980d10adfca84d31aaedcb.zip gdb-36a2283dad09124b2d980d10adfca84d31aaedcb.tar.gz gdb-36a2283dad09124b2d980d10adfca84d31aaedcb.tar.bz2 |
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.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index c3bb3a4..0a4c841 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -150,6 +150,13 @@ cp_print_class_method (valaddr, type, stream) } } +/* This was what it was for gcc 2.4.5 and earlier. */ +static const char vtbl_ptr_name_old[] = + { CPLUS_MARKER,'v','t','b','l','_','p','t','r','_','t','y','p','e', 0 }; +/* It was changed to this after 2.4.5. */ +const char vtbl_ptr_name[] = + { '_','_','v','t','b','l','_','p','t','r','_','t','y','p','e', 0 }; + /* Return truth value for assertion that TYPE is of the type "pointer to virtual function". */ @@ -158,12 +165,6 @@ cp_is_vtbl_ptr_type(type) struct type *type; { char *typename = type_name_no_tag (type); - /* This was what it was for gcc 2.4.5 and earlier. */ - static const char vtbl_ptr_name_old[] = - { CPLUS_MARKER,'v','t','b','l','_','p','t','r','_','t','y','p','e', 0 }; - /* It was changed to this after 2.4.5. */ - static const char vtbl_ptr_name[] = - { '_','_','v','t','b','l','_','p','t','r','_','t','y','p','e', 0 }; return (typename != NULL && (STREQ (typename, vtbl_ptr_name) @@ -178,14 +179,20 @@ cp_is_vtbl_member(type) struct type *type; { if (TYPE_CODE (type) == TYPE_CODE_PTR) - type = TYPE_TARGET_TYPE (type); - else - return 0; - - if (TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT) - /* Virtual functions tables are full of pointers to virtual functions. */ - return cp_is_vtbl_ptr_type (TYPE_TARGET_TYPE (type)); + { + type = TYPE_TARGET_TYPE (type); + if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + { + type = TYPE_TARGET_TYPE (type); + if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using thunks */ + || TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + { + /* Virtual functions tables are full of pointers + to virtual functions. */ + return cp_is_vtbl_ptr_type (type); + } + } + } return 0; } |