From aa2071bd242e144dc6764517a0a6117b6a5a1661 Mon Sep 17 00:00:00 2001 From: Paul Koning Date: Mon, 3 Oct 2011 16:15:26 +0000 Subject: [PATCH] * gdb.python/py-value.exp (python inval = gdb.parse_and_eval('*(int*)0')) (python argc_lazy = gdb.parse_and_eval('argc'), sanity check argc) (set argc=2, python print argc_lazy): New tests. --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.python/py-value.exp | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cdd18379726..908e469cfac 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-10-03 Paul Koning + Jan Kratochvil + + * gdb.python/py-value.exp + (python inval = gdb.parse_and_eval('*(int*)0')) + (python argc_lazy = gdb.parse_and_eval('argc'), sanity check argc) + (set argc=2, python print argc_lazy): New tests. + 2011-10-02 Joel Brobecker * gdb.base/save-bp.exp, gdb.base/save-bp.c: New files. diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index 35fe0be4375..92065c531cf 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -236,6 +236,18 @@ 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" + 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 argc_lazy = gdb.parse_and_eval('argc')" + gdb_test "print argc" " = 1" "sanity check argc" + gdb_test_no_output "set argc=2" + gdb_test "python print argc_lazy" "\r\n1" + # Test string fetches, both partial and whole. gdb_test "print st" "\"divide et impera\"" gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1 -- 2.30.2