From: Gary Benson Date: Tue, 27 Oct 2020 17:02:39 +0000 (+0000) Subject: Fix gdb.python/py-format-string.exp with Clang X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=934a1764071ebe9d6e148e741b55bafb036a7cc6;p=binutils-gdb.git 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6f92df87a64..a260377b9fa 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-10-14 Gary Benson + + * gdb.python/py-format-string.exp (test_deref_refs): Treat + "_vptr$Base" as correct, in addition to "_vptr.Base". + (test_mixed): Likewise. + 2020-10-27 Gary Benson * gdb.mi/mi-fortran-modules.exp: Check skip_fortran_tests. diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp index 792d60c09db..b7acc242ed3 100644 --- a/gdb/testsuite/gdb.python/py-format-string.exp +++ b/gdb/testsuite/gdb.python/py-format-string.exp @@ -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} , a = 42, static a_static_member = 2019\\}" + "${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} , 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} , a = 42\\}" + "${default_ref_regexp}: \\{_vptr\[.\$\]Base = ${default_pointer_regexp} , a = 42\\}" } }