diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-03-03 03:55:31 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-03-03 03:55:31 +0000 |
commit | c171f8549ca05c866ec967d76e7f4575a0465643 (patch) | |
tree | b7c3d71e82cc5c4ac0bc57d093fc4cace361d108 /gdb/testsuite | |
parent | 3351ea09d2187a84d3b3fbca715d571748128a3e (diff) | |
download | gdb-c171f8549ca05c866ec967d76e7f4575a0465643.zip gdb-c171f8549ca05c866ec967d76e7f4575a0465643.tar.gz gdb-c171f8549ca05c866ec967d76e7f4575a0465643.tar.bz2 |
py-inferior.exp: Avoid searching pattern beyond buffer
gdb/testsuite/ChangeLog:
* gdb.python/py-inferior.exp: Avoid searching pattern beyond
end of buffer.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-inferior.exp | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ac9bd0e..bce369f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-03 Joel Brobecker <brobecker@adacore.com> + + * gdb.python/py-inferior.exp: Avoid searching pattern beyond + end of buffer. + 2011-03-02 Joel Brobecker <brobecker@adacore.com> * gdb.python/py-inferior.exp: Use gdb_test_no_output instead of diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index c219117..138c0fb 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -171,15 +171,15 @@ set CHUNK_SIZE 16000 ; gdb_test_no_output "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678" gdb_test_no_output "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678" gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')" -gdb_test_no_output "py length = gdb.selected_frame ().read_var ('search_buf_size')" +gdb_test_no_output "py end_addr = start_addr + gdb.selected_frame ().read_var ('search_buf_size')" gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0x12345678)" -gdb_test_no_output "py first = gdb.inferiors()\[0\].search_memory (start_addr,length, pattern)" +gdb_test_no_output "py first = gdb.inferiors()\[0\].search_memory (start_addr,end_addr - start_addr, pattern)" gdb_test "py print first" "${one_pattern_found}" "search spanning large range 1st result" gdb_test_no_output "py start_addr = first + 1" -gdb_test_no_output "py second = gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" +gdb_test_no_output "py second = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)" gdb_test "py print second" "${one_pattern_found}" "search spanning large range 2nd result" gdb_test_no_output "py start_addr = second + 1" -gdb_test_no_output "py third = gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" +gdb_test_no_output "py third = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)" gdb_test "py print third" "${pattern_not_found}" "search spanning large range 3rd result" # For native targets, test a pattern straddling a chunk boundary. @@ -188,6 +188,6 @@ if [isnative] { gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)" gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')" - gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ + gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)" \ "${one_pattern_found}" "find pattern straddling chunk boundary" } |