* gdb.python/py-value.exp: Add testcases for is_lazy attribute,

fetch_lazy method.
This commit is contained in:
Paul Koning 2011-10-25 18:35:49 +00:00
parent 22dbab4672
commit 54d8a6445f
2 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2011-10-25 Paul Koning <paul_koning@dell.com>
PR python/13327
* gdb.python/py-value.exp: Add testcases for is_lazy attribute,
fetch_lazy method.
2011-10-24 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (can_single_step_to_signal_handler): Return 0 when

View File

@ -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\""