[PATCH] GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure

Maciej W. Rozycki-5
Fix a catastrophic failure in gdb.base/step-over-no-symbols.exp where
remote target communication issues cause the value of the PC retrieved
to be empty:

(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f551500000056424d40435c2f7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
ERROR: tcl error sourcing .../gdb/testsuite/gdb.base/step-over-no-symbols.exp.
ERROR: missing operand at _@_
in expression " _@_!= "
    (parsing expression " != ")
    invoked from within
"expr $before_addr != $after_addr"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 expr $condition"
    (procedure "gdb_assert" line 6)
    invoked from within
"gdb_assert {$before_addr != $after_addr} "advanced""
    (procedure "test_step_over" line 36)
    invoked from within
"test_step_over $displaced"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $body"
    invoked from within
"with_test_prefix "displaced=$displaced" {
        test_step_over $displaced
    }"
    ("foreach" body line 6)
    invoked from within
"foreach displaced { "off" "on" "auto" } {
    if { $displaced != "off" && ![support_displaced_stepping] } {
        continue
    }

    with_test_prefix "dis..."
    (file ".../gdb/testsuite/gdb.base/step-over-no-symbols.exp" line 84)
    invoked from within
"source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
Remote debugging from host xxx.xxx.xxx.xxx, port 47130
monitor exit
Killing process(es): 1092
Remote communication error.  Target disconnected.: Connection reset by peer.
(gdb)

To do so verify first, before making an arithmetic comparison, that the
values to compare are actually integers (using a string comparison would
result in a false PASS if both operands were empty, as in this case),
making the test script proceed normally:

(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f5515000000424d40435c2f7c7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host xxx.xxx.xxx.xxx, port 48404
monitor exit
Killing process(es): 1795
Remote communication error.  Target disconnected.: Connection reset by peer.
(gdb)

Note the double curly braces, to take advantage of `&&' operator's lazy
evaluation.

        gdb/testsuite/
        * gdb.base/step-over-no-symbols.exp: Verify that $before_addr
        and $after_addr are both integers before making a comparison.
---
Hi,

 Observed and verified with the `riscv64-linux-gnu' target in remote
testing with commit c35d018b1a5e ("RISC-V: Fix gdbserver problem with
handling arch strings.") reverted.

 OK to apply?

  Maciej
---
 gdb/testsuite/gdb.base/step-over-no-symbols.exp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

gdb-test-step-over-no-symbols-no-pc.diff
Index: binutils-gdb/gdb/testsuite/gdb.base/step-over-no-symbols.exp
===================================================================
--- binutils-gdb.orig/gdb/testsuite/gdb.base/step-over-no-symbols.exp
+++ binutils-gdb/gdb/testsuite/gdb.base/step-over-no-symbols.exp
@@ -78,7 +78,9 @@ proc test_step_over { displaced } {
 
     set after_addr [get_pc "get after PC"]
 
-    gdb_assert {$before_addr != $after_addr} "advanced"
+    gdb_assert {{[string is integer -strict $before_addr] \
+ && [string is integer -strict $after_addr] \
+ && $before_addr != $after_addr}} "advanced"
 }
 
 foreach displaced { "off" "on" "auto" } {
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure

Kevin Buettner
On Sat, 8 Feb 2020 16:57:30 +0000 (GMT)
"Maciej W. Rozycki" <[hidden email]> wrote:

...
> Note the double curly braces, to take advantage of `&&' operator's lazy
> evaluation.
>
> gdb/testsuite/
> * gdb.base/step-over-no-symbols.exp: Verify that $before_addr
> and $after_addr are both integers before making a comparison.

Thanks for the detailed explanation!

This is okay.

Kevin

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure

Maciej W. Rozycki-5
On Sat, 8 Feb 2020, Kevin Buettner wrote:

> > * gdb.base/step-over-no-symbols.exp: Verify that $before_addr
> > and $after_addr are both integers before making a comparison.
>
> Thanks for the detailed explanation!
>
> This is okay.

 Committed now, thanks for your review.

  Maciej