This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 0/3] Trust readonly sections if target has memory protection
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 6 Sep 2013 10:01:57 +0800
- Subject: [PATCH 0/3] Trust readonly sections if target has memory protection
- Authentication-results: sourceware.org; auth=none
Hi,
When option "trust-readonly-sections" was introduced in this patch
http://www.sourceware.org/ml/gdb-patches/2002-01/msg00711.html, there
was the discussion to turn it on in default. However, we didn't do
that because we have a concern that bad or buggy program may modify the
code on the non-memory protected system. On the other hand, it is
highly recommended to turn this on in remote debugging.
I am wondering if we can teach GDB to trust read-only sections if it
knows the target system has memory protection. For some targets, such
as linux, we know they do have memory protection. This is what this
patch series tries to do.
This change improves GDB's out-of-box performance. I wrote a
micro-benchmark to disassemble GDB in GDB in remote debugging
(native-gdbserver) on x86-linux, and collect the time usage
and the number of 'm' packets,
/wo patch /w patch
time usage : 0.44s 0.10
number of 'm' : 43157 4
As we can see, the number of RSP 'm' packet is reduced dramatically,
and the time usage is reduced to some extent. In my experiment,
GDBserver is running natively, so connection speed is quite fast. In
some slow connections, the improvement will be more.
This patch series only teach GDB to trust readonly sections on
GNU/Linux targets. Some ancient Windows targets don't have memory
protection, so we can't let GDB to rust readoly sections on mingw
and cygwin target.
*** BLURB HERE ***
Yao Qi (3):
set trust-readonly-sections off in test cases
Trust readonly sections if target has memory protection
Linux has memory protection.
gdb/NEWS | 4 ++++
gdb/arch-utils.c | 7 +++++++
gdb/arch-utils.h | 2 ++
gdb/doc/gdb.texinfo | 11 +++++++++--
gdb/gdbarch.c | 24 ++++++++++++++++++++++++
gdb/gdbarch.h | 6 ++++++
gdb/gdbarch.sh | 3 +++
gdb/linux-tdep.c | 10 ++++++++++
gdb/target.c | 28 ++++++++++++++++++++--------
gdb/testsuite/gdb.base/break-always.exp | 4 ++++
gdb/testsuite/gdb.mi/mi-fill-memory.exp | 5 +++++
11 files changed, 94 insertions(+), 10 deletions(-)
--
1.7.7.6