From: Paul Koning Date: Tue, 25 Oct 2011 18:35:49 +0000 (+0000) Subject: * gdb.python/py-value.exp: Add testcases for is_lazy attribute, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54d8a6445fa1b27e4cd03307af963828cf337f9f;p=binutils-gdb.git * gdb.python/py-value.exp: Add testcases for is_lazy attribute, fetch_lazy method. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 92221247277..db459a40721 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-10-25 Paul Koning + + PR python/13327 + + * gdb.python/py-value.exp: Add testcases for is_lazy attribute, + fetch_lazy method. + 2011-10-24 Yao Qi * lib/gdb.exp (can_single_step_to_signal_handler): Return 0 when diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index 92065c531cf..59d79aeb4ac 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -236,17 +236,27 @@ proc test_value_in_inferior {} { gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test } - # Test Python values are not lazy. - set test "memory error occurs even for possibly lazy values" + # Test Python lazy value handling + set test "memory error and lazy values" if {$can_read_0} { untested $test } else { - gdb_test "python inval = gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test + gdb_test "python inval = gdb.parse_and_eval('*(int*)0')" + gdb_test "python print inval.is_lazy" "True" + gdb_test "python inval2 = inval+1" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test + gdb_test "python inval.fetch_lazy ()" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test } gdb_test "python argc_lazy = gdb.parse_and_eval('argc')" + gdb_test "python argc_notlazy = gdb.parse_and_eval('argc')" + gdb_test "python argc_notlazy.fetch_lazy()" + gdb_test "python print argc_lazy.is_lazy" "True" + gdb_test "python print argc_notlazy.is_lazy" "False" gdb_test "print argc" " = 1" "sanity check argc" + gdb_test "python print argc_lazy.is_lazy" "\r\nTrue" gdb_test_no_output "set argc=2" - gdb_test "python print argc_lazy" "\r\n1" + gdb_test "python print argc_notlazy" "\r\n1" + gdb_test "python print argc_lazy" "\r\n2" + gdb_test "python print argc_lazy.is_lazy" "False" # Test string fetches, both partial and whole. gdb_test "print st" "\"divide et impera\""