From 0e5e3ea669deb649cd05af6dd07e9a8753113ec9 Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 16 Mar 2002 20:53:14 +0000 Subject: [PATCH] * cp-valprint.c (cp_is_vtbl_ptr_type): Handle vtbl field type for gcc versions after gcc-2.8.1. --- gdb/ChangeLog | 5 +++++ gdb/cp-valprint.c | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d6e49f85698..291f092b908 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-03-16 Peter Schauer + + * cp-valprint.c (cp_is_vtbl_ptr_type): Handle vtbl field type + for gcc versions after gcc-2.8.1. + 2002-03-16 Peter Schauer * eval.c (evaluate_subexp_standard): Fix setup of ``this'' pointer diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 669203121c8..7ea9f3f94e9 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -1,6 +1,6 @@ /* Support for printing C++ values for GDB, the GNU debugger. Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -201,6 +201,8 @@ cp_is_vtbl_ptr_type (struct type *type) int cp_is_vtbl_member (struct type *type) { + /* With older versions of g++, the vtbl field pointed to an array + of structures. Nowadays it points directly to the structure. */ if (TYPE_CODE (type) == TYPE_CODE_PTR) { type = TYPE_TARGET_TYPE (type); @@ -215,6 +217,17 @@ cp_is_vtbl_member (struct type *type) return cp_is_vtbl_ptr_type (type); } } + else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) /* if not using thunks */ + { + return cp_is_vtbl_ptr_type (type); + } + else if (TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + { + /* The type name of the thunk pointer is NULL when using dwarf2. + We could test for a pointer to a function, but there is + no type info for the virtual table either, so it wont help. */ + return cp_is_vtbl_ptr_type (type); + } } return 0; } -- 2.30.2