diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-11-12 21:44:49 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@codesourcery.com> | 2010-11-12 21:44:49 +0000 |
commit | ae9d7ce40fc2cb634140c62af0208b48eabf6cfb (patch) | |
tree | 43f781ee54f9de2e637738fcb0b932c79451d8ed /gdb/testsuite | |
parent | 621c83642d17cf523c20f55f2ed945a7ec95ea6a (diff) | |
download | gdb-ae9d7ce40fc2cb634140c62af0208b48eabf6cfb.zip gdb-ae9d7ce40fc2cb634140c62af0208b48eabf6cfb.tar.gz gdb-ae9d7ce40fc2cb634140c62af0208b48eabf6cfb.tar.bz2 |
gdb/testsuite/
* gdb.python/py-inferior.exp: Pack values in target endianness.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-inferior.exp | 25 |
2 files changed, 22 insertions, 7 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3c62b9d..0694d9c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-11-12 Nathan Froyd <froydnj@codesourcery.com> + + * gdb.python/py-inferior.exp: Pack values in target endianness. + 2010-11-12 Tom Tromey <tromey@redhat.com> * gdb.python/py-prettyprint.c (main): Add new 'ns2' local. diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index 45f43a1..7998b92 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -34,6 +34,17 @@ clean_restart ${testfile} # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } +gdb_test_multiple "show endian" "getting target endian" { + -re ".*little endian.*$gdb_prompt $" { + set python_pack_char "<" + # pass silently + } + -re ".*big endian.*$gdb_prompt $" { + set python_pack_char ">" + # pass silently + } +} + # The following tests require execution. if ![runto_main] then { @@ -106,7 +117,7 @@ gdb_test "set int16_search_buf\[10\] = 0x1234" "" "" gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" "" gdb_test "py start_addr = search_buf.address" "" "" gdb_test "py length = search_buf.type.sizeof" "" "" -gdb_test "py pattern = pack('H',0x1234)" "" \ +gdb_test "py pattern = pack('${python_pack_char}H',0x1234)" "" \ gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ "${one_pattern_found}" "find 16-bit pattern, with value pattern" @@ -117,7 +128,7 @@ gdb_test "set int32_search_buf\[10\] = 0x12345678" "" "" gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" "" gdb_test "py start_addr = search_buf.address" "" "" gdb_test "py length = search_buf.type.sizeof" "" "" -gdb_test "py pattern = pack('I',0x12345678)" "" \ +gdb_test "py pattern = pack('${python_pack_char}I',0x12345678)" "" \ gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ "${one_pattern_found}" "find 32-bit pattern, with python pattern" @@ -128,7 +139,7 @@ gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" "" gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" "" gdb_test "py start_addr = search_buf.address" "" "" gdb_test "py length = search_buf.type.sizeof" "" "" -gdb_test "py pattern = pack('Q', 0xfedcba9876543210)" "" "" +gdb_test "py pattern = pack('${python_pack_char}Q', 0xfedcba9876543210)" "" "" gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ "${one_pattern_found}" "find 64-bit pattern, with value pattern" @@ -141,8 +152,8 @@ gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" "" gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" "" gdb_test "py start_addr = search_buf\[0\].address" "" "" gdb_test "py pattern1 = pack('B', 0x62)" "" "" -gdb_test "py pattern2 = pack('H', 0x6363)" "" "" -gdb_test "py pattern3 = pack('I', 0x64646464)" "" "" +gdb_test "py pattern2 = pack('${python_pack_char}H', 0x6363)" "" "" +gdb_test "py pattern3 = pack('${python_pack_char}I', 0x64646464)" "" "" gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern1)" \ "${one_pattern_found}" "find mixed-sized pattern" @@ -161,7 +172,7 @@ gdb_test "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678" "" "" gdb_test "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678" "" "" gdb_test "py start_addr = gdb.selected_frame ().read_var ('search_buf')" "" "" gdb_test "py length = gdb.selected_frame ().read_var ('search_buf_size')" "" "" -gdb_test "py pattern = pack('I', 0x12345678)" "" "" +gdb_test "py pattern = pack('${python_pack_char}I', 0x12345678)" "" "" gdb_test "py first = gdb.inferiors()\[0\].search_memory (start_addr,length, pattern)" "" "" gdb_test "py print first" "${one_pattern_found}" "search spanning large range 1st result" gdb_test "py start_addr = first + 1" @@ -175,7 +186,7 @@ gdb_test "py print third" "${pattern_not_found}" "search spanning large range 3r if [isnative] { gdb_test "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" "" "" - gdb_test "py pattern = pack('I', 0xfdb97531)" "" "" + gdb_test "py pattern = pack('${python_pack_char}I', 0xfdb97531)" "" "" gdb_test "py start_addr = gdb.selected_frame ().read_var ('search_buf')" "" "" gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ "${one_pattern_found}" "find pattern straddling chunk boundary" |