From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Cc: pedro@codesourcery.com
Cc: vegorov@chromium.org
Cc: ppluzhnikov@google.com
Subject: [patch 1/2] Speed up JIT support
Date: Thu, 03 Feb 2011 21:46:00 -0000 [thread overview]
Message-ID: <20110203214614.5FD74190A4E@elbrus2.mtv.corp.google.com> (raw)
Greetings,
In earlier thread: http://sourceware.org/ml/gdb/2011-01/msg00009.html, Pedro
suggested that we should eliminate repeated symbol lookups by stashing
relevant info in per-objfile data.
This series of patches implements the idea.
The first patch merely reshuffles the code around to make it more convenient
to cache the results. The second patch is the "meat" of the change.
Timing results using:
/usr/bin/time ./gdb -nx -q -ex 'run' -ex quit --args \
testsuite/gdb.base/jit-main testsuite/gdb.base/jit-solib.so N
### before ###
N time
300 1.04user 0.19system 0:01.24elapsed 99%CPU
400 2.75user 0.16system 0:02.94elapsed 98%CPU
500 5.70user 0.30system 0:06.04elapsed 99%CPU
600 10.98user 0.28system 0:11.31elapsed 99%CPU
700 18.56user 0.30system 0:18.96elapsed 99%CPU
800 28.57user 0.46system 0:29.16elapsed 99%CPU
### after ###
N time
600 0.48user 0.25system 0:00.75elapsed 96%CPU
1000 1.04user 0.40system 0:01.44elapsed 99%CPU
2000 3.17user 0.95system 0:04.23elapsed 97%CPU
3000 7.20user 1.44system 0:08.89elapsed 97%CPU
4000 13.67user 1.93system 0:15.97elapsed 97%CPU
5000 23.41user 2.46system 0:26.41elapsed 97%CPU
This is still showing non-linear growth, but the factors are much nicer ;-)
Next up: move jit_breakpoint_re_set into breakpoint.c and make it use
the same mechanism (lookup_minimal_symbol{,_text} are still major CPU
consumers, though find_pc_section moves to the top spot).
Thanks,
--
Paul Pluzhnikov
2010-02-03 Paul Pluzhnikov <ppluzhnikov@google.com>
* breakpoint.c (create_overlay_event_breakpoint): Adjust.
(create_longjmp_master_breakpoint): Adjust.
(create_std_terminate_master_breakpoint): Adjust.
(update_breakpoints_after_exec): Adjust.
(breakpoint_re_set): Adjust.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.532
diff -u -p -r1.532 breakpoint.c
--- breakpoint.c 31 Jan 2011 21:37:01 -0000 1.532
+++ breakpoint.c 3 Feb 2011 21:37:16 -0000
@@ -2218,9 +2218,10 @@ create_internal_breakpoint (struct gdbar
}
static void
-create_overlay_event_breakpoint (char *func_name)
+create_overlay_event_breakpoint (void)
{
struct objfile *objfile;
+ const char *const func_name = "_ovly_debug_event";
ALL_OBJFILES (objfile)
{
@@ -2251,48 +2252,64 @@ create_overlay_event_breakpoint (char *f
}
static void
-create_longjmp_master_breakpoint (char *func_name)
+create_longjmp_master_breakpoint (void)
{
struct program_space *pspace;
- struct objfile *objfile;
struct cleanup *old_chain;
old_chain = save_current_program_space ();
ALL_PSPACES (pspace)
- ALL_OBJFILES (objfile)
+ {
+ struct objfile *objfile;
+
+ set_current_program_space (pspace);
+
+ ALL_OBJFILES (objfile)
{
- struct breakpoint *b;
- struct minimal_symbol *m;
+ const char *const longjmp_names[]
+ = { "longjmp", "_longjmp", "siglongjmp", "_siglongjmp" };
+ const int num_longjmp_names
+ = sizeof (longjmp_names) / sizeof (longjmp_names[0]);
+ int i;
+ struct gdbarch *gdbarch;
- if (!gdbarch_get_longjmp_target_p (get_objfile_arch (objfile)))
+ gdbarch = get_objfile_arch (objfile);
+ if (!gdbarch_get_longjmp_target_p (gdbarch))
continue;
- set_current_program_space (pspace);
+ for (i = 0; i < num_longjmp_names; i++)
+ {
+ struct breakpoint *b;
+ struct minimal_symbol *m;
+ const char *func_name;
- m = lookup_minimal_symbol_text (func_name, objfile);
- if (m == NULL)
- continue;
+ func_name = longjmp_names[i];
+ m = lookup_minimal_symbol_text (func_name, objfile);
+ if (m == NULL)
+ continue;
- b = create_internal_breakpoint (get_objfile_arch (objfile),
- SYMBOL_VALUE_ADDRESS (m),
- bp_longjmp_master);
- b->addr_string = xstrdup (func_name);
- b->enable_state = bp_disabled;
+ b = create_internal_breakpoint (gdbarch,
+ SYMBOL_VALUE_ADDRESS (m),
+ bp_longjmp_master);
+ b->addr_string = xstrdup (func_name);
+ b->enable_state = bp_disabled;
+ }
}
+ }
update_global_location_list (1);
do_cleanups (old_chain);
}
-/* Create a master std::terminate breakpoint. The actual function
- looked for is named FUNC_NAME. */
+/* Create a master std::terminate breakpoint. */
static void
-create_std_terminate_master_breakpoint (const char *func_name)
+create_std_terminate_master_breakpoint (void)
{
struct program_space *pspace;
struct objfile *objfile;
struct cleanup *old_chain;
+ const char *const func_name = "std::terminate()";
old_chain = save_current_program_space ();
@@ -2462,12 +2479,9 @@ update_breakpoints_after_exec (void)
}
}
/* FIXME what about longjmp breakpoints? Re-create them here? */
- create_overlay_event_breakpoint ("_ovly_debug_event");
- create_longjmp_master_breakpoint ("longjmp");
- create_longjmp_master_breakpoint ("_longjmp");
- create_longjmp_master_breakpoint ("siglongjmp");
- create_longjmp_master_breakpoint ("_siglongjmp");
- create_std_terminate_master_breakpoint ("std::terminate()");
+ create_overlay_event_breakpoint ();
+ create_longjmp_master_breakpoint ();
+ create_std_terminate_master_breakpoint ();
create_exception_master_breakpoint ();
}
@@ -10716,12 +10730,9 @@ breakpoint_re_set (void)
do_cleanups (old_chain);
- create_overlay_event_breakpoint ("_ovly_debug_event");
- create_longjmp_master_breakpoint ("longjmp");
- create_longjmp_master_breakpoint ("_longjmp");
- create_longjmp_master_breakpoint ("siglongjmp");
- create_longjmp_master_breakpoint ("_siglongjmp");
- create_std_terminate_master_breakpoint ("std::terminate()");
+ create_overlay_event_breakpoint ();
+ create_longjmp_master_breakpoint ();
+ create_std_terminate_master_breakpoint ();
create_exception_master_breakpoint ();
}
\f
next reply other threads:[~2011-02-03 21:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-03 21:46 Paul Pluzhnikov [this message]
2011-02-03 21:58 ` [patch 2/2] " Paul Pluzhnikov
2011-02-04 18:58 ` Pedro Alves
2011-02-04 20:17 ` Tom Tromey
2011-02-04 20:33 ` Paul Pluzhnikov
2011-02-05 0:26 ` Paul Pluzhnikov
2011-02-07 15:31 ` Tom Tromey
2011-02-15 21:56 ` Paul Pluzhnikov
2011-02-04 18:28 ` [patch 1/2] " Pedro Alves
2011-02-04 20:00 ` Tom Tromey
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=20110203214614.5FD74190A4E@elbrus2.mtv.corp.google.com \
--to=ppluzhnikov@google.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/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