From: Tom de Vries Date: Sat, 6 Feb 2021 22:22:03 +0000 (+0100) Subject: [gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c0e5674584a590cdaecb7ef47d58e3aedb4be14a;p=binutils-gdb.git [gdb/testsuite] Fix gdb.tui/tui-layout-asm.exp with -m32 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. gdb/testsuite/ChangeLog: 2021-02-06 Tom de Vries PR testsuite/26922 * gdb.tui/tui-layout-asm.exp: Ignore whitespace mismatches when scrolling. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5875843472c..222e8198fd0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2021-02-06 Tom de Vries + + PR testsuite/26922 + * gdb.tui/tui-layout-asm.exp: Ignore whitespace mismatches when + scrolling. + 2021-02-05 Tom de Vries PR breakpoints/27313 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)"