This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python: fetch value when building gdb.Value object


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]