aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-10-01 11:02:11 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-10-01 11:02:11 +0000
commit46f886f1f598b001afc5cb85be195714464459d1 (patch)
tree3602f8da62eac37b8e19a0b6b2545eb490605e79
parent4ca9de19cd24a4fd2c9cf8902640092d69721940 (diff)
downloadgdb-46f886f1f598b001afc5cb85be195714464459d1.zip
gdb-46f886f1f598b001afc5cb85be195714464459d1.tar.gz
gdb-46f886f1f598b001afc5cb85be195714464459d1.tar.bz2
gdb/testsuite/
* gdb.python/py-value.exp (test_value_in_inferior): New variable can_read_0, test for it. (python print gdb.parse_and_eval('*(int*)0')): Rename to ... (parse_and_eval with memory error): ... here, make it untested if can_read_0.
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.python/py-value.exp19
2 files changed, 27 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b5b40ef..a2380a0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2011-10-01 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Pedro Alves <pedro@codesourcery.com>
+
+ * gdb.python/py-value.exp (test_value_in_inferior): New variable
+ can_read_0, test for it.
+ (python print gdb.parse_and_eval('*(int*)0')): Rename to ...
+ (parse_and_eval with memory error): ... here, make it untested if
+ can_read_0.
+
2011-09-30 Marek Polacek <mpolacek@redhat.com>
* gdb.python/python.exp (verify pagination beforehand)
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index bb9bed5..35fe0be 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -216,8 +216,25 @@ proc test_value_in_inferior {} {
# Test address attribute
gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute"
+ # Test displaying a variable that is temporarily at a bad address.
+ # But if we can examine what's at memory address 0, then we'll also be
+ # able to display it without error. Don't run the test in that case.
+ set can_read_0 0
+ gdb_test_multiple "x 0" "memory at address 0" {
+ -re "0x0:\[ \t\]*Cannot access memory at address 0x0\r\n$gdb_prompt $" { }
+ -re "0x0:\[ \t\]*Error accessing memory address 0x0\r\n$gdb_prompt $" { }
+ -re "\r\n$gdb_prompt $" {
+ set can_read_0 1
+ }
+ }
+
# Test memory error.
- gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*"
+ set test "parse_and_eval with memory error"
+ if {$can_read_0} {
+ untested $test
+ } else {
+ gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*" $test
+ }
# Test string fetches, both partial and whole.
gdb_test "print st" "\"divide et impera\""