Fix two buglets in cp_print_value_fields patch

Message ID 20190618153830.20876-1-tromey@adacore.com
State New, archived
Headers

Commit Message

Tom Tromey June 18, 2019, 3:38 p.m. UTC
  Pedro and Tom both pointed out issues in the cp_print_value_fields
patch, aka the fix for PR c++/20020.

This patch addresses both issues.  Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-06-18  Tom Tromey  <tromey@adacore.com>

	* cp-valprint.c (cp_print_value_fields): Pass opts, not options,
	to cp_print_static_field.

gdb/testsuite/ChangeLog
2019-06-18  Tom Tromey  <tromey@adacore.com>

	* gdb.cp/constexpr-field.exp: Use setup_xfail.
---
 gdb/ChangeLog                            | 5 +++++
 gdb/cp-valprint.c                        | 2 +-
 gdb/testsuite/ChangeLog                  | 4 ++++
 gdb/testsuite/gdb.cp/constexpr-field.exp | 3 ++-
 4 files changed, 12 insertions(+), 2 deletions(-)
  

Comments

Tom Tromey June 27, 2019, 1:51 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> Pedro and Tom both pointed out issues in the cp_print_value_fields
Tom> patch, aka the fix for PR c++/20020.

Tom> This patch addresses both issues.  Tested on x86-64 Fedora 29.

Tom> gdb/ChangeLog
Tom> 2019-06-18  Tom Tromey  <tromey@adacore.com>

Tom> 	* cp-valprint.c (cp_print_value_fields): Pass opts, not options,
Tom> 	to cp_print_static_field.

Tom> gdb/testsuite/ChangeLog
Tom> 2019-06-18  Tom Tromey  <tromey@adacore.com>

Tom> 	* gdb.cp/constexpr-field.exp: Use setup_xfail.

I'm checking this in now.

Tom
  

Patch

diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 5781d7ab561..d3a38d885d8 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -302,7 +302,7 @@  cp_print_value_fields (struct type *type, struct type *real_type,
 
 		      cp_print_static_field (TYPE_FIELD_TYPE (type, i),
 					     v, stream, recurse + 1,
-					     options);
+					     opts);
 		    }
 		  catch (const gdb_exception_error &ex)
 		    {
diff --git a/gdb/testsuite/gdb.cp/constexpr-field.exp b/gdb/testsuite/gdb.cp/constexpr-field.exp
index e4849efeae9..2f71cef952a 100644
--- a/gdb/testsuite/gdb.cp/constexpr-field.exp
+++ b/gdb/testsuite/gdb.cp/constexpr-field.exp
@@ -31,6 +31,7 @@  if {![runto_main]} {
 
 # "x" sometimes isn't available due to
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90526
-gdb_test "print x" " = {static f = .*}"
+setup_xfail *-*-* gcc/90526
+gdb_test "print x" " = {static f = true}"
 
 gdb_test "print y" " = {static f = true}"