public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32
@ 2021-02-05 16:30 Tom de Vries
  2021-02-06 20:41 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-02-05 16:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Hi,

When running test-case gdb.tui/tui-layout-asm.exp with target board
unix/-m32, we run into:
...
FAIL: gdb.tui/tui-layout-asm.exp: scroll to end of assembler (scroll failed)
...

Comparing screen dumps (edited a bit to fit column width) before:
...
 0 +--------------------------------------------------------------------+
 1 | 0x8049194 <__libc_csu_init+68>  call   *-0x104(%ebp,%esi,4)        |
 2 | 0x804919b <__libc_csu_init+75>  add    $0x1,%esi                   |
 3 | 0x804919e <__libc_csu_init+78>  add    $0x10,%esp                  |
 4 | 0x80491a1 <__libc_csu_init+81>  cmp    %esi,%ebx                   |
 5 | 0x80491a3 <__libc_csu_init+83>  jne    0x8049188 <__...>           |
 6 | 0x80491a5 <__libc_csu_init+85>  add    $0xc,%esp                   |
 7 | 0x80491a8 <__libc_csu_init+88>  pop    %ebx                        |
 8 | 0x80491a9 <__libc_csu_init+89>  pop    %esi                        |
 9 | 0x80491aa <__libc_csu_init+90>  pop    %edi                        |
10 | 0x80491ab <__libc_csu_init+91>  pop    %ebp                        |
11 | 0x80491ac <__libc_csu_init+92>  ret                                |
12 | 0x80491ad                           lea    0x0(%esi),%esi          |
13 | 0x80491b0 <__libc_csu_fini>     ret                                |
14 +--------------------------------------------------------------------+
...
and after:
...
 0 +--------------------------------------------------------------------+
 1 | 0x804919b <__libc_csu_init+75>          add    $0x1,%esi           |
 2 | 0x804919e <__libc_csu_init+78>          add    $0x10,%esp          |
 3 | 0x80491a1 <__libc_csu_init+81>          cmp    %esi,%ebx           |
 4 | 0x80491a3 <__libc_csu_init+83>          jne    0x8049188 <__...>   |
 5 | 0x80491a5 <__libc_csu_init+85>          add    $0xc,%esp           |
 6 | 0x80491a8 <__libc_csu_init+88>          pop    %ebx                |
 7 | 0x80491a9 <__libc_csu_init+89>          pop    %esi                |
 8 | 0x80491aa <__libc_csu_init+90>          pop    %edi                |
 9 | 0x80491ab <__libc_csu_init+91>          pop    %ebp                |
10 | 0x80491ac <__libc_csu_init+92>          ret                        |
11 | 0x80491ad                                   lea    0x0(%esi),%esi  |
12 | 0x80491b0 <__libc_csu_fini>             ret                        |
13 | 0x80491b1 <__x86.get_pc_thunk.bp>       mov    (%esp),%ebp         |
14 +--------------------------------------------------------------------+
...
it seems the mismatch comes from the extra indentation forced by the longer
<__x86.get_pc_thunk.bp> that was scrolled in.

Fix this by ignoring whitespace when comparing scrolled lines.

Tested on x86_64-linux, using -m64 and -m32.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32

gdb/testsuite/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26922
	* gdb.tui/tui-layout-asm.exp: Ignore whitespace mismatches when
	scrolling.

---
 gdb/testsuite/gdb.tui/tui-layout-asm.exp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp
index 347064aacc6..19ce333ca9e 100644
--- a/gdb/testsuite/gdb.tui/tui-layout-asm.exp
+++ b/gdb/testsuite/gdb.tui/tui-layout-asm.exp
@@ -58,8 +58,11 @@ while (1) {
     # Send the down key to GDB.
     send_gdb "\033\[B"
     incr down_count
-    if {[Term::wait_for [string_to_regexp $line]] \
-	    && [Term::get_line 1] == $line} {
+    set re_line [string_to_regexp $line]
+    # Ignore whitespace mismatches.
+    regsub -all {\s+} $re_line {\s+} re_line
+    if {[Term::wait_for $re_line] \
+	    && [regexp $re_line [Term::get_line 1]]} {
 	# We scrolled successfully.
     } else {
 	fail "$testname (scroll failed)"

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

* Re: [PATCH][gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32
  2021-02-05 16:30 [PATCH][gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32 Tom de Vries
@ 2021-02-06 20:41 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-02-06 20:41 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Tom Tromey

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

Tom> gdb/testsuite/ChangeLog:

Tom> 2021-02-05  Tom de Vries  <tdevries@suse.de>

Tom> 	PR testsuite/26922
Tom> 	* gdb.tui/tui-layout-asm.exp: Ignore whitespace mismatches when
Tom> 	scrolling.

Seems reasonable to me.  Thank you.

Tom

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

end of thread, other threads:[~2021-02-06 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 16:30 [PATCH][gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32 Tom de Vries
2021-02-06 20:41 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).