From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 0/3] Use target_read_code in skip_prologue
Date: Fri, 29 Nov 2013 14:27:00 -0000 [thread overview]
Message-ID: <1385735051-27558-1-git-send-email-yao@codesourcery.com> (raw)
GDB is able to cache memory accesses requested in target_read_code,
so target_read_code is more efficient than general target_read_memory.
This patch series use target_read_code and its variant in the
skip_prologue related code, and it improves the performance when doing
'b foo' (foo is a function) in remote debugging.
Nowadays, when we set a breakpoint on function f1, GDB will fetch the
code in f1 to determine the start of the function body (say skip the
prologue), it requests read from target many times on x86, see below,
(gdb) b f1
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,e#9c...Packet received: 5589e5b8000000005dc35589e583
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,5#6e...Packet received: e5b8000000
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,5#6e...Packet received: e5b8000000
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,1#6a...Packet received: e5
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c4,e#9c...Packet received: 5589e5b8000000005dc35589e583
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,5#6e...Packet received: e5b8000000
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,5#6e...Packet received: e5b8000000
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c5,1#69...Packet received: 89
Sending packet: $m80483c6,1#6a...Packet received: e5
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c7,1#6b...Packet received: b8
Sending packet: $m80483c4,1#68...Packet received: 55
Sending packet: $m80483c7,1#6b...Packet received: b8
these address are identical or close to, so caching
should be useful here. With this patch applied, the
number of RSP 'm' packets are reduced,
(gdb) b f1
Sending packet: $m80483c0,40#97...Packet received: ffd0c9c35589e5b8000000005dc35589e583ec188b450c8945f88b45108945fc8b45148945f08b45188945f48b45f80345088945ecdb45ecdc45f0d97dea0fb7
Sending packet: $m80483c7,1#6b...Packet received: b8
Note that once we use target_read_code in breakpoint.c, the last 'm'
will disappear too.
The changes are quite specific to each port, because skip_prologue is
port specific.
Patch #3 adds a perf test case. We run it on x86-linux and get the
result below.
Base Patched
skip-prologue cpu_time 1 1.77 0.08
skip-prologue cpu_time 2 2.66 0.09
skip-prologue cpu_time 3 2.09 0.1
skip-prologue wall_time 1 3.79094099998 0.138980865479
skip-prologue wall_time 2 5.69234204292 0.132542133331
skip-prologue wall_time 3 4.39887309074 0.157964944839
skip-prologue vmsize 1 16336 16336
skip-prologue vmsize 2 16336 16336
skip-prologue vmsize 3 16336 16336
*** BLURB HERE ***
Yao Qi (3):
Use target_read_code in skip_prologue (i386)
skip_prolgoue (amd64)
Perf test case: skip-prologue
gdb/amd64-tdep.c | 10 ++--
gdb/corefile.c | 32 +++++++++++++
gdb/gdbcore.h | 17 +++++++
gdb/i386-tdep.c | 71 +++++++++++++++---------------
gdb/testsuite/gdb.perf/skip-prologue.c | 48 ++++++++++++++++++++
gdb/testsuite/gdb.perf/skip-prologue.exp | 59 +++++++++++++++++++++++++
gdb/testsuite/gdb.perf/skip-prologue.py | 39 ++++++++++++++++
7 files changed, 236 insertions(+), 40 deletions(-)
create mode 100644 gdb/testsuite/gdb.perf/skip-prologue.c
create mode 100644 gdb/testsuite/gdb.perf/skip-prologue.exp
create mode 100644 gdb/testsuite/gdb.perf/skip-prologue.py
--
1.7.7.6
next reply other threads:[~2013-11-29 14:27 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 14:27 Yao Qi [this message]
2013-11-29 14:27 ` [PATCH 2/3] skip_prolgoue (amd64) Yao Qi
2013-11-29 14:38 ` Mark Kettenis
2013-11-29 18:55 ` Mark Kettenis
2013-11-30 3:40 ` Yao Qi
2013-11-30 12:01 ` Pedro Alves
2013-12-02 7:34 ` Yao Qi
2013-12-03 18:28 ` Pedro Alves
2013-12-04 2:34 ` Yao Qi
2013-12-04 12:08 ` Pedro Alves
2013-12-04 15:38 ` Tom Tromey
2013-12-04 18:31 ` Doug Evans
2013-12-05 11:31 ` Pedro Alves
2013-12-05 1:21 ` Yao Qi
2013-12-05 12:08 ` Pedro Alves
2013-12-05 14:08 ` Yao Qi
2013-12-05 14:37 ` Pedro Alves
2013-12-08 8:01 ` Yao Qi
2013-12-08 8:26 ` Doug Evans
2013-12-09 1:45 ` Yao Qi
2013-12-09 11:32 ` Pedro Alves
2013-12-09 11:53 ` Pedro Alves
2013-12-09 13:03 ` Yao Qi
2013-12-09 13:13 ` Pedro Alves
2013-12-09 13:58 ` Yao Qi
2013-12-09 15:34 ` Pedro Alves
2013-12-10 0:57 ` Yao Qi
2013-12-10 10:23 ` Pedro Alves
2013-12-10 12:02 ` Yao Qi
2013-12-04 17:42 ` Doug Evans
2013-12-04 18:00 ` Doug Evans
2013-12-04 17:54 ` Doug Evans
2013-12-05 1:39 ` Yao Qi
2013-12-05 11:47 ` Pedro Alves
2013-11-29 14:36 ` [PATCH 1/3] Use target_read_code in skip_prologue (i386) Yao Qi
2013-11-30 11:43 ` Pedro Alves
2013-11-29 14:38 ` [PATCH 3/3] Perf test case: skip-prologue Yao Qi
2013-12-03 7:34 ` Yao Qi
2013-12-10 12:45 ` Yao Qi
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=1385735051-27558-1-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@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