diff options
author | Doug Evans <dje@google.com> | 2013-12-10 16:20:08 -0800 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2013-12-10 16:20:08 -0800 |
commit | 0987cf351276271164c94b3bc8ca54482573bda4 (patch) | |
tree | 6f5e90b28a6fcbdadcfd1a29c56c3ac5b8fde3df /gdb/testsuite/gdb.python/py-value.exp | |
parent | 34dc884e1711a3d00c6815bf32aa5823390ff1f6 (diff) | |
download | binutils-gdb-0987cf351276271164c94b3bc8ca54482573bda4.tar.gz |
PR 16286
* c-lang.c (c_get_string): Ignore the declared size of the object
if a specific length is requested.
testsuite/
* gdb.python/py-value.c: #include stdlib.h, string.h.
(str): New struct.
(main): New local xstr.
* gdb.python/py-value.exp (test_value_in_inferior): Add test to
fetch a value as a string with a length beyond the declared length
of the array.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-value.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/py-value.exp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index 43de063ad00..a0521048141 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -291,6 +291,12 @@ proc test_value_in_inferior {} { # For the purposes of this test, use repr() gdb_py_test_silent_cmd "python nullst = nullst.string (length = 9)" "get string beyond null" 1 gdb_test "python print (repr(nullst))" "u?'divide\\\\x00et'" + + # Test fetching a string longer than its declared (in C) size. + # PR 16286 + gdb_py_test_silent_cmd "python xstr = gdb.parse_and_eval('xstr')" "get xstr" 1 + gdb_test "python print xstr\['text'\].string (length = xstr\['length'\])" "x{100}" \ + "read string beyond declared size" } proc test_lazy_strings {} { |