aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2017-03-14 19:20:46 +0100
committerAndreas Arnez <arnez@linux.vnet.ibm.com>2017-03-14 19:20:46 +0100
commit87c336f60eccc6506ff19369c29575f43fea02ea (patch)
treef6484e93cfe87fa5b4bfe1e8283d18f2ad7bb498 /etc
parentd47c3ff7d55122befac848fe64b7445789c78787 (diff)
downloadgdb-87c336f60eccc6506ff19369c29575f43fea02ea.zip
gdb-87c336f60eccc6506ff19369c29575f43fea02ea.tar.gz
gdb-87c336f60eccc6506ff19369c29575f43fea02ea.tar.bz2
inf-ptrace: Do not stop memory transfers after a single word
When inf_ptrace_xfer_partial performs a memory transfer via ptrace with PT_READ_I, PT_WRITE_I (aka PTRACE_PEEKTEXT, PTRACE_POKETEXT), etc., then it currently transfers at most one word. This behavior yields degraded performance, particularly if the caller has significant preparation work for each invocation. And indeed it has for writing, in memory_xfer_partial in target.c, where all of the remaining data to be transferred is copied to a temporary buffer each time, for breakpoint shadow handling. Thus large writes have quadratic runtime and can take hours. Note: On GNU/Linux targets GDB usually does not use inf_ptrace_xfer_partial for large memory transfers, but attempts a single read/write from/to /proc/<pid>/mem instead. However, the kernel may reject writes to /proc/<pid>/mem (such as kernels prior to 2.6.39), or /proc may not be mounted. In both cases GDB falls back to the ptrace mechanism. This patch fixes the performance issue by attempting to fulfill the whole transfer request in inf_ptrace_xfer_partial, using a loop around the ptrace call. gdb/ChangeLog: PR gdb/21220 * inf-ptrace.c (inf_ptrace_xfer_partial): In "case TARGET_OBJECT_MEMORY", extract the logic for ptrace peek/poke... (inf_ptrace_peek_poke): ...here. New function. Now also loop over ptrace peek/poke until end of buffer or error.
Diffstat (limited to 'etc')
0 files changed, 0 insertions, 0 deletions