diff options
author | Maciej W. Rozycki <macro@wdc.com> | 2020-02-10 08:59:04 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@wdc.com> | 2020-02-10 08:59:04 +0000 |
commit | 5f0e2eb79e6b771779eab6f5a8cf33c5c889ca85 (patch) | |
tree | c1389c72a2187e9be219898256c3b3585dbbc2e7 | |
parent | 33176d912add7680277ad5e18af0e6303d9a7af8 (diff) | |
download | gdb-5f0e2eb79e6b771779eab6f5a8cf33c5c889ca85.zip gdb-5f0e2eb79e6b771779eab6f5a8cf33c5c889ca85.tar.gz gdb-5f0e2eb79e6b771779eab6f5a8cf33c5c889ca85.tar.bz2 |
GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure
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.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/step-over-no-symbols.exp | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 42c8e8f..ef43995 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-02-10 Maciej W. Rozycki <macro@wdc.com> + + * gdb.base/step-over-no-symbols.exp: Verify that $before_addr + and $after_addr are both integers before making a comparison. + 2020-02-09 Tom de Vries <tdevries@suse.de> * gdb.base/many-headers.exp: Echo gdb command to gdb.log. Capture gdb diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp index 44b993a..bc715d7 100644 --- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp +++ b/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" } { |