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.
This commit is contained in:
Jan Kratochvil 2011-10-01 11:02:11 +00:00
parent 4ca9de19cd
commit 46f886f1f5
2 changed files with 27 additions and 1 deletions

View File

@ -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)

View File

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