Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix gdb.python/py-format-string.exp with -m32
@ 2021-01-18  9:53 Tom de Vries
  2021-01-20 19:58 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-01-18  9:53 UTC (permalink / raw)
  To: gdb-patches

Hi,

When running test-case gdb.python/py-format-string.exp with target board
unix/-m32, we run into:
...
(gdb) python print \
  (gdb.parse_and_eval ('a_base_ref').format_string (deref_refs=True))^M
@0xffffc468: {_vptr.Base = 0x80487e0 <vtable for Deriv+8>, a = 42, \
              static a_static_member = 2019}^M
(gdb) FAIL: gdb.python/py-format-string.exp: format_string: \
  lang_cpp: a_base_ref with option deref_refs: deref_refs=true
...
while with -m64, we have instead:
...
@0x7fffffffd170: {_vptr.Base = 0x400910 <vtable for Deriv+16>, a = 42, \
                  static a_static_member = 2019}^M
(gdb) PASS: gdb.python/py-format-string.exp: format_string: \
  lang_cpp: a_base_ref with option deref_refs: deref_refs=true
...

The vtable contains pointer entries which are 4-byte for -m32 and 8-byte for
-m64, so it's not surprising the offsets (Deriv+8 vs. Deriv+16) differ.

Fix this by allow Deriv+$decimal.

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.python/py-format-string.exp with -m32

gdb/testsuite/ChangeLog:

2021-01-18  Tom de Vries  <tdevries@suse.de>

	* gdb.python/py-format-string.exp: Allow Deriv+$decimal as vtable
	offset.

---
 gdb/testsuite/gdb.python/py-format-string.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 8163df7ad56..160e9019cda 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -534,6 +534,7 @@ proc test_deref_refs {} {
   global current_lang
   global default_pointer_regexp
   global default_ref_regexp
+  global decimal
 
   check_var_with_bool_opt "deref_refs" "a_point_t"
   check_var_with_bool_opt "deref_refs" "a_point_t_pointer"
@@ -551,7 +552,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\\+$decimal>, a = 42, static a_static_member = 2019\\}"
   }
 }
 
@@ -923,6 +924,7 @@ proc test_mixed {} {
   global current_lang
   global default_ref_regexp
   global default_pointer_regexp
+  global decimal
 
   check_format_string "a_point_t" \
     "raw=True, format='x'" \
@@ -947,7 +949,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\\+$decimal>, a = 42\\}"
   }
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][gdb/testsuite] Fix gdb.python/py-format-string.exp with -m32
  2021-01-18  9:53 [PATCH][gdb/testsuite] Fix gdb.python/py-format-string.exp with -m32 Tom de Vries
@ 2021-01-20 19:58 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-01-20 19:58 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> 2021-01-18  Tom de Vries  <tdevries@suse.de>

Tom> 	* gdb.python/py-format-string.exp: Allow Deriv+$decimal as vtable
Tom> 	offset.

Looks good.  Thank you.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-20 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18  9:53 [PATCH][gdb/testsuite] Fix gdb.python/py-format-string.exp with -m32 Tom de Vries
2021-01-20 19:58 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox