Fix gdb.python/py-format-string.exp with Clang

GDB includes the virtual table pointer when formatting polymorphic
C++ objects for printing, but GCC and Clang name these differently:
GCC emits a DW_AT_name of "_vptr.Base" when describing the virtual
table pointer of a type derived from type "Base", whereas Clang
will emit "_vptr$Base" in this situation.  This commit fixes a
testcase which failed because of this.

gdb/testsuite/ChangeLog:

	* gdb.python/py-format-string.exp (test_deref_refs): Treat
	"_vptr$Base" as correct, in addition to "_vptr.Base".
	(test_mixed): Likewise.
This commit is contained in:
Gary Benson 2020-10-27 17:02:39 +00:00
parent 0bf21fbd79
commit 934a176407
2 changed files with 8 additions and 2 deletions

View file

@ -509,7 +509,7 @@ proc test_deref_refs {} {
if { $current_lang == "c++" } {
check_var_with_bool_opt "deref_refs" "a_point_t_ref"
check_var_with_bool_opt "deref_refs" "a_base_ref" \
"${default_ref_regexp}: \\{_vptr\\.Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42, static a_static_member = 2019\\}"
"${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42, static a_static_member = 2019\\}"
}
}
@ -905,7 +905,7 @@ proc test_mixed {} {
check_format_string "a_base_ref" \
"deref_refs=True, static_members=False" \
"${default_ref_regexp}: \\{_vptr\\.Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42\\}"
"${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} <vtable for Deriv\\+16>, a = 42\\}"
}
}