[PATCH 2/3] gdb: Set max-value-size before running tests.

Andrew Burgess
2015-12-11T21:38:56Z

Setting the max-value-size before running any tests should prevent any
issues where a failing test causes gdb to bring down the testing
machine.

The maximum size is set to 1G, this is large enough to handle all the
well behaving tests, and should make no difference to the test results.

There is one test, gdb.mi/mi-vla-fortran.exp that contains undefined
behaviour, one some machines this test is known to trigger the
max-value-size error. However, on those machines the test would have
failed anyway, so this commit does not change the PASS / FAIL nature of
the test. A later commit should modify the mi-vla-fortran.exp test to
expect the failure case.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (default_gdb_start): Set max-value-size.
* lib/mi-support.exp (default_mi_gdb_start): Likewise.
* gdb.base/max-value-size.exp: Don't check the initial value.
---
gdb/testsuite/ChangeLog | 6 ++++++
gdb/testsuite/gdb.base/max-value-size.exp | 8 +++-----
gdb/testsuite/lib/gdb.exp | 10 ++++++++++
gdb/testsuite/lib/mi-support.exp | 10 ++++++++++
4 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 93bb3bb..0673d01 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>

+ * lib/gdb.exp (default_gdb_start): Set max-value-size.
+ * lib/mi-support.exp (default_mi_gdb_start): Likewise.
+ * gdb.base/max-value-size.exp: Don't check the initial value.
+
+2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
+
* gdb.base/max-value-size.c: New file.
* gdb.base/max-value-size.exp: New file.

diff --git a/gdb/testsuite/gdb.base/max-value-size.exp b/gdb/testsuite/gdb.base/max-value-size.exp
index cb09ad8..21f4552 100644
--- a/gdb/testsuite/gdb.base/max-value-size.exp
+++ b/gdb/testsuite/gdb.base/max-value-size.exp
@@ -25,11 +25,9 @@ if ![runto_main] then {
return 0
}

-gdb_test "show max-value-size" \
- "Maximum value size is unlimited." \
- "the initial value of max-value-size is unlimited"
-
-with_test_prefix "max-value-size is 'unlimited'" {
+# The testing infrastructure does set the max-value-size, however, it
+# should always be large enough for these values.
+with_test_prefix "using initial max-value-size" {
gdb_test "p/d one" " = 0"
gdb_test "p/d one_hundred" " = \\{0 <repeats 100 times>\\}"
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index beb97ea..215feba 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1631,6 +1631,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
+ # set maximum value size to 1G, no tests currently require more.
+ send_gdb "set max-value-size 1024 * 1024 * 1024\n"
+ gdb_expect 10 {
+ -re "$gdb_prompt $" {
+ verbose "Setting max-value-size to 1G" 2
+ }
+ timeout {
+ warning "Couldn't set the max-value-size to 1G."
+ }
+ }
return 0
}

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 9619fb3..ab64366 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -204,6 +204,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
+ # set maximum value size to 1G, no tests currently require more.
+ send_gdb "102-gdb-set max-value-size 1024 * 1024 * 1024\n"
+ gdb_expect 10 {
+ -re ".*102-gdb-set max-value-size \[^\r\n\]+\r\n102\\\^done\r\n$mi_gdb_prompt$" {
+ verbose "Setting max-value-size to 1G" 2
+ }
+ timeout {
+ warning "Couldn't set the max-value-size to 1G."
+ }
+ }

# Create the new PTY for the inferior process.
if { $separate_inferior_pty } {
--
2.5.1