This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Python: fetch value when building gdb.Value object
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, Phil Muldoon <pmuldoon at redhat dot com>, Paul Koning <paulkoning at comcast dot net>
- Date: Sat, 1 Oct 2011 11:22:46 +0100
- Subject: Re: Python: fetch value when building gdb.Value object
- References: <36B29E9D-F2B3-446F-AF8A-97254A3AAEE2@comcast.net> <m3ipocii6a.fsf@redhat.com> <20111001092852.GB11227@host1.jankratochvil.net>
On Saturday 01 October 2011 10:28:52, Jan Kratochvil wrote:
> # Test memory error.
> gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*"
> + gdb_test "python inval = gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*"
I see this is already the case, but just a reminder that this will fail
(or rather the write will succeed) on targets without an MMU. We should
skip it with something like:
set can_read_zero 0
gdb_test_multiple "x 0" "memory at address 0" {
-re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
-re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" {
set can_read_zero 1
}
}
if { !$can_read_zero } {
gdb_test "python print gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*"
gdb_test "python inval = gdb.parse_and_eval('*(int*)0')" "gdb.MemoryError: Cannot access memory at address 0x0.*"
}
--
Pedro Alves