public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] PR gdb/21220: Fix quadratic runtime of memory writes into inferior on GNU/Linux
@ 2017-03-06 16:01 Andreas Arnez
  2017-03-06 16:01 ` [PATCH 1/3] inf-ptrace: Do not stop memory transfers after a single word Andreas Arnez
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Andreas Arnez @ 2017-03-06 16:01 UTC (permalink / raw)
  To: gdb-patches

On GNU/Linux native targets, when writing into inferior memory, only a
single word is currently transferred at a time.  This causes trouble with
large transfers, because memory_xfer_partial wastes a lot of effort in
this case: allocate a buffer and copy all remaining bytes of the transfer
request into it, then fill the breakpoints in, but just transfer the first
word of this buffer, and drop the rest.  This quadratic behavior affects
large "restore" operations, as reported by PR 21220, as well as
reverse-stepping a large memory-copy instruction, such as in the
s390-specific test case s390-mvcle.exp.  The quadratic run-time of a large
restore operation was already addressed and circumvented by this patch:

  https://sourceware.org/ml/gdb-patches/2013-07/msg00611.html -- "Improve
  performance of large restore commands"

But then another patch broke the circumvention:

  https://sourceware.org/ml/gdb-patches/2016-06/msg00565.html -- "Optimize
  memory_xfer_partial for remote"

This series fixes the problem in two different ways:

* When using ptrace with PTRACE_POKEDATA, do not return to the caller
  after transferring a single word, but attempt to fulfill the whole
  transfer request in one invocation.

* If possible, do not even use PTRACE_POKEDATA, but write to
  /proc/<pid>/mem instead.

To avoid another regression, a new dump/restore test case is added as
well.

Andreas Arnez (3):
  inf-ptrace: Do not stop memory transfers after a single word
  Test case for dump/restore of large array
  linux-nat: Exploit /proc/<pid>/mem for writing

 gdb/inf-ptrace.c                | 115 ++++++++++++++++++----------------------
 gdb/linux-nat.c                 |  32 +++++------
 gdb/testsuite/gdb.base/dump.c   |  37 +++++++++++++
 gdb/testsuite/gdb.base/dump.exp |   8 +++
 4 files changed, 112 insertions(+), 80 deletions(-)

-- 
2.3.0

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

end of thread, other threads:[~2017-03-14 15:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 16:01 [PATCH 0/3] PR gdb/21220: Fix quadratic runtime of memory writes into inferior on GNU/Linux Andreas Arnez
2017-03-06 16:01 ` [PATCH 1/3] inf-ptrace: Do not stop memory transfers after a single word Andreas Arnez
2017-03-08 19:10   ` Simon Marchi
2017-03-09 17:22     ` Andreas Arnez
2017-03-10 15:49       ` Simon Marchi
2017-03-13 19:39         ` Pedro Alves
2017-03-13 19:50           ` Andreas Arnez
2017-03-13 19:51             ` Pedro Alves
2017-03-14 15:12               ` Andreas Arnez
2017-03-14 15:23                 ` Pedro Alves
2017-03-06 16:02 ` [PATCH 2/3] Test case for dump/restore of large array Andreas Arnez
2017-03-13 19:51   ` Pedro Alves
2017-03-06 16:03 ` [PATCH 3/3] linux-nat: Exploit /proc/<pid>/mem for writing Andreas Arnez
2017-03-13 20:05   ` Pedro Alves
2017-03-13 20:08     ` Pedro Alves
2017-03-14 11:23       ` Andreas Arnez
2017-03-14  9:54     ` Andreas Arnez

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).