public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix search of large memory area in gdbserver
Date: Wed, 22 Apr 2020 19:25:20 +0000 (GMT)	[thread overview]
Message-ID: <20200422192520.84A3E3858D33@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=51ac8e22655ba777498249ae0c776fd794a2c298

commit 51ac8e22655ba777498249ae0c776fd794a2c298
Author: Hannes Domani <ssbssa@yahoo.de>
Date:   Wed Apr 22 19:05:07 2020 +0200

    Fix search of large memory area in gdbserver
    
    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.

Diff:
---
 gdbserver/ChangeLog | 5 +++++
 gdbserver/server.cc | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 96642e5cf39..f017922d9e1 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -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
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 77175ff74cb..0672f9bc4d1 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -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.",


                 reply	other threads:[~2020-04-22 19:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422192520.84A3E3858D33@sourceware.org \
    --to=ssbssa@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).