Fix search of large memory area in gdbserver
authorHannes Domani <ssbssa@yahoo.de>
Wed, 22 Apr 2020 17:05:07 +0000 (19:05 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Wed, 22 Apr 2020 19:23:39 +0000 (21:23 +0200)
If the search area is bigger than SEARCH_CHUNK_SIZE (16000), then you get
an error in gdbserver:
gdb: (gdb) find /w 0x3c43f0,+20000,0x04030201
gdb: Pattern not found.
gdbserver: Unable to access 3997 bytes of target memory at 0x3c8273, halting search.

The return value of any additional gdb_read_memory calls were compared with the
wrong value, this fixes it.

gdbserver/ChangeLog:

2020-04-22  Hannes Domani  <ssbssa@yahoo.de>

* server.cc (handle_search_memory_1): Fix gdb_read_memory return value
comparison.

gdbserver/ChangeLog
gdbserver/server.cc

index 96642e5cf391413c06fd384f86b87b7e49770772..f017922d9e1f3175d9dcee59365c98d2379814fb 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-22  Hannes Domani  <ssbssa@yahoo.de>
+
+       * server.cc (handle_search_memory_1): Fix gdb_read_memory return value
+       comparison.
+
 2020-04-16  Tom Tromey  <tromey@adacore.com>
 
        * win32-low.cc (windows_nat::handle_access_violation): New
index 77175ff74cb3e1b698e8fb1922859568de71e6d1..0672f9bc4d10cfccf167c3a0d2d0a1e41302caa0 100644 (file)
@@ -1103,7 +1103,7 @@ handle_search_memory_1 (CORE_ADDR start_addr, CORE_ADDR search_space_len,
                        : chunk_size);
 
          if (gdb_read_memory (read_addr, search_buf + keep_len,
-                              nr_to_read) != search_buf_size)
+                              nr_to_read) != nr_to_read)
            {
              warning ("Unable to access %ld bytes of target memory "
                       "at 0x%lx, halting search.",