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]

PATCH: fix PR gdb/10783


We had a customer bug report that the GDB find command was not correctly finding things given a large search range. This was using gdbserver on an arm-none-linux-gnueabi target. I independently tracked this down to the same problem reported in PR 10783 -- it affects the target-side gdbserver search code as well as the server-side simple_search_memory function. The attached patch fixes both places. Note that the version of the patch attached to the issue also didn't correctly handle the keep_len != 0 case (e.g., find/w instead of find/b).

I tested this with the arm-none-linux-gnueabi gdbserver case using lots of different combinations of search ranges to verify that it was correctly finding and reporting the match no matter what the offset within the range.

OK to check in?

-Sandra


2009-10-29 Sandra Loosemore <sandra@codesourcery.com>


PR gdb/10783

	gdb/
	* target.c (simple_search_memory): Correct read_addr initialization
	in loop for searching subsequent chunks.
	
	gdb/gdbserver/
	* server.c (handle_search_memory_1): Correct read_addr initialization
	in loop for searching subsequent chunks.
Index: gdb/target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.230
diff -u -r1.230 target.c
--- gdb/target.c	26 Oct 2009 18:28:13 -0000	1.230
+++ gdb/target.c	29 Oct 2009 17:58:39 -0000
@@ -2305,7 +2305,7 @@
       if (search_space_len >= pattern_len)
 	{
 	  unsigned keep_len = search_buf_size - chunk_size;
-	  CORE_ADDR read_addr = start_addr + keep_len;
+	  CORE_ADDR read_addr = start_addr + chunk_size + keep_len;
 	  int nr_to_read;
 
 	  /* Copy the trailing part of the previous iteration to the front
Index: gdb/gdbserver/server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.103
diff -u -r1.103 server.c
--- gdb/gdbserver/server.c	9 Oct 2009 00:31:01 -0000	1.103
+++ gdb/gdbserver/server.c	29 Oct 2009 17:58:39 -0000
@@ -557,7 +557,7 @@
       if (search_space_len >= pattern_len)
 	{
 	  unsigned keep_len = search_buf_size - chunk_size;
-	  CORE_ADDR read_addr = start_addr + keep_len;
+	  CORE_ADDR read_addr = start_addr + chunk_size + keep_len;
 	  int nr_to_read;
 
 	  /* Copy the trailing part of the previous iteration to the front

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