[patchv2] gdb.base/valgrind-infcall.exp compat. with Ubuntu 10.04.4

Jan Kratochvil
2012-08-07T11:39:57Z

Hi Doug,

added there also some unrealted new protection against infinite loop which I
got in today's nightly run, to make it a single commit to the same code.

BTW I do not see how it could happen (it is not reproducible for me):

(gdb) target remote | /usr/lib/valgrind/../../bin/vgdb --pid=20165
Remote debugging using | /usr/lib/valgrind/../../bin/vgdb --pid=20165
relaying data between gdb and process 20165
Unknown remote qXfer reply: PacketSize=3fff;QStartNoAckMode+;QPassSignals+;qXfer:auxv:read+;qXfer:features:read+
(gdb) FAIL: gdb.base/valgrind-infcall.exp: target remote for vgdb

Jan

On Tue, 07 Aug 2012 08:43:03 +0200, Jan Kratochvil wrote:
Hi Doug,

according to freenode #gdb

(2012-08-07 00:02:56 GMT)
xdje: jankratochvil: I'm seeing valgrind-infcall.exp failing. While the docs
for gdb_test_multiple claim the action is performed in the caller's context,
that doesn't appear to be the case ...
(2012-08-07 00:03:29 GMT)
xdje: ... and the "break" for finding "Invalid free" is a nop, and we take the
"Remote connection closed" exit.

It works on Fedora systems and also on Ubuntu 12.04.
On reported Ubuntu 10.04.4 the testcase quits early as UNSUPPORTED because
valgrind is too old there.
So I do not see how to test it, except for building custom valgrind there.

Does it work for you this way?

Thanks,
Jan

gdb/testsuite/
2012-08-07 Jan Kratochvil <jan.kratochvil@redhat.com>

* gdb.base/valgrind-infcall.exp (continue #$continue_count): Use
global variable loop, not a 'break'. Add loop count limit to 100.
Add new fail case for terminated vgdb.

diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.exp b/gdb/testsuite/gdb.base/valgrind-infcall.exp
index 3224e9c..84d6819 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall.exp
+++ b/gdb/testsuite/gdb.base/valgrind-infcall.exp
@@ -90,17 +90,23 @@ gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
gdb_test "monitor v.set gdb_output" "valgrind output will go to gdb.*"

set continue_count 1
-while 1 {
+set loop 1
+while {$loop && $continue_count < 100} {
set test "continue #$continue_count"
gdb_test_multiple "continue" "" {
-re "Invalid free\\(\\).*: main .*\r\n$gdb_prompt $" {
pass $test
- break
+ # In Ubuntu 10.04.4 environments 'break' does not work here.
+ set loop 0
}
-re "Remote connection closed.*\r\n$gdb_prompt $" {
fail "$test (remote connection closed)"
return -1
}
+ -re "The program is not being run\\.\r\n$gdb_prompt $" {
+ fail "$test (valgrind vgdb has terminated)"
+ return -1
+ }
-re "\r\n$gdb_prompt $" {
pass "$test (false warning)"
}