aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/huge.exp
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-12-11 17:37:49 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2016-02-01 18:05:35 +0000
commit5fdf6324fafd60f967e2e8323fdacf84b1bfcea3 (patch)
treeb7fa72f4b96fccd13aa8fb068b5472bacc64c8bf /gdb/testsuite/gdb.base/huge.exp
parentb125bd17270aca2af4d945ce8477f981dbc27e7e (diff)
downloadgdb-5fdf6324fafd60f967e2e8323fdacf84b1bfcea3.zip
gdb-5fdf6324fafd60f967e2e8323fdacf84b1bfcea3.tar.gz
gdb-5fdf6324fafd60f967e2e8323fdacf84b1bfcea3.tar.bz2
gdb: New set/show max-value-size command.
For languages with dynamic types, an incorrect program, or uninitialised variables within a program, could result in an incorrect, overly large type being associated with a value. Currently, attempting to print such a variable will result in gdb trying to allocate an overly large buffer. If this large memory allocation fails then the result can be gdb either terminating, or (due to memory contention) becoming unresponsive for the user. A new user visible variable in gdb helps guard against such problems, two new commands are available: set max-value-size show max-value-size The 'max-value-size' is the maximum size of memory in bytes that gdb will allocate for the contents of a value. Any attempt to allocate a value with a size greater than this will result in an error. The initial default for this limit is set at 64k, this is based on a similar limit that exists within the ada specific code. It is possible for the user to set max-value-size to unlimited, in which case the old behaviour is restored. gdb/ChangeLog: * value.c (max_value_size): New variable. (MIN_VALUE_FOR_MAX_VALUE_SIZE): New define. (show_max_value_size): New function. (check_type_length_before_alloc): New function. (allocate_value_contents): Call check_type_length_before_alloc. (set_value_enclosing_type): Likewise. (_initialize_values): Add set/show handler for max-value-size. * NEWS: Mention new set/show command. gdb/doc/ChangeLog: * gdb.texinfo (Value Sizes): New section. (Data): Add the 'Value Sizes' node to the menu. gdb/testsuite/ChangeLog: * gdb.base/max-value-size.c: New file. * gdb.base/max-value-size.exp: New file. * gdb.base/huge.exp: Disable max-value-size for this test.
Diffstat (limited to 'gdb/testsuite/gdb.base/huge.exp')
-rw-r--r--gdb/testsuite/gdb.base/huge.exp2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp
index 018f305..4dca89b 100644
--- a/gdb/testsuite/gdb.base/huge.exp
+++ b/gdb/testsuite/gdb.base/huge.exp
@@ -47,6 +47,8 @@ if { ! [ runto_main ] } then {
return -1
}
+gdb_test_no_output "set max-value-size unlimited"
+
gdb_test "print a" ".1 = .0 .repeats \[0123456789\]+ times.." "print a very large data object"
set timeout $prev_timeout