Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* patch for search bug in gdbserver
@ 2018-03-24 10:41 Game Debugger
  2018-03-24 10:54 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Game Debugger @ 2018-03-24 10:41 UTC (permalink / raw)
  To: gdb patches

$greeting$
 
found while trying to search memory via gdbserver
it just doesn't work except when target pattern is in the first block read
 
 
patch was obvious once i dug into the code; and is tested
looks like original bug was a copy and paste error from top of loop
 
 
 
pls let me know if you ise it
 
 
 
ty
$name$
 
 
============= PATCH FOLLOWS
 
 
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 64c72bd..943dfb2 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1123,7 +1123,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.",
 
 
 
=============== PATCH FINISHED :)
 
 
$signature$


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patch for search bug in gdbserver
  2018-03-24 10:41 patch for search bug in gdbserver Game Debugger
@ 2018-03-24 10:54 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2018-03-24 10:54 UTC (permalink / raw)
  To: Game Debugger, gdb patches

Hi!

Thanks much for finding the program and for the patch.

On 03/24/2018 10:41 AM, Game Debugger wrote:

> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
> index 64c72bd..943dfb2 100644
> --- a/gdb/gdbserver/server.c
> +++ b/gdb/gdbserver/server.c
> @@ -1123,7 +1123,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.",
>  
>  
>  
> =============== PATCH FINISHED :)

Close, but not yet :-)  It'd be really good to add a test to the
testsuite to exercise this and make sure we don't break the fix
ever again.  Clearly we don't have a test yet that covers
this scenario otherwise we'd have noticed the problem before!
Maybe add it to gdb/testsuite/gdb.base/find.{c,exp}?

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-24 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-24 10:41 patch for search bug in gdbserver Game Debugger
2018-03-24 10:54 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox