* [patch] Eliminate quadratic slow-down on number of solibs (take 2).
@ 2009-06-09 0:51 Paul Pluzhnikov
2009-06-15 15:18 ` Paul Pluzhnikov
2009-06-15 22:20 ` Tom Tromey
0 siblings, 2 replies; 6+ messages in thread
From: Paul Pluzhnikov @ 2009-06-09 0:51 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1625 bytes --]
On Wed, Jun 3, 2009 at 2:34 PM, Tom Tromey<tromey@redhat.com> wrote:
> Paul> The problem is that the call chain is deep:
> Yeah, but it can be simplified.
> Paul> flags=<value optimized out>) at ../../src/gdb/symfile.c:1033
> Paul> #5 0x00000000004e3ee5 in symbol_file_add_from_bfd (abfd=0xd57fe0,
> Paul> from_tty=0, addrs=0x0, mainline=0, flags=<value optimized out>)
> Paul> at ../../src/gdb/symfile.c:1103
>
> These are all just forwarding calls, basically overloads.
> You could add a new overload just for this purpose.
But they may call themselves recursively.
I've added a bit to OBJF_* flags instead.
How about attached patch then?
On a 1500+ solib test case I see 20% reduction in CPU, measured as:
time gdb -ex 'break main' -ex run -ex quit custom_test
Before (best time):
real 1m1.724s
user 0m56.776s
sys 0m4.852s
After:
real 0m51.596s
user 0m46.739s
sys 0m4.820s
Tested on Linux/x86_64, no new failures.
Thanks,
--
Paul Pluzhnikov
2009-06-08 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib.c (symbol_add_stub): Add DEFER_BP_RESET parameter.
(solib_read_symbols): Add DEFER_BP_RESET parameter.
(solib_add): Defer breakpoint reset.
* solib.h (solib_read_symbols): Adjust prototype.
* symfile.c (new_symfile_objfile): Add FLAGS parameter.
(symbol_file_add_with_addrs_or_offsets): Adjust call.
* symfile.h (new_symfile_objfile): Adjust prototype.
* objfile.h (OBJF_DEFER_BP_RESET): New define.
* bsd-uthread.c (bsd_uthread_solib_loaded): Adjust call.
* rs6000-nat.c (objfile_symbol_add): Adjust call.
[-- Attachment #2: gdb-breakpoint-20090608.txt --]
[-- Type: text/plain, Size: 7209 bytes --]
Index: solib.h
===================================================================
RCS file: /cvs/src/src/gdb/solib.h,v
retrieving revision 1.24
diff -u -p -u -r1.24 solib.h
--- solib.h 15 May 2009 16:53:44 -0000 1.24
+++ solib.h 9 Jun 2009 00:49:30 -0000
@@ -34,7 +34,7 @@ extern void clear_solib (void);
/* Called to add symbols from a shared library to gdb's symbol table. */
extern void solib_add (char *, int, struct target_ops *, int);
-extern int solib_read_symbols (struct so_list *, int);
+extern int solib_read_symbols (struct so_list *, int, int);
/* Function to be called when the inferior starts up, to discover the
names of shared libraries that are dynamically linked, the base
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.119
diff -u -p -u -r1.119 solib.c
--- solib.c 3 Jun 2009 18:50:36 -0000 1.119
+++ solib.c 9 Jun 2009 00:49:31 -0000
@@ -448,30 +448,29 @@ master_so_list (void)
return so_list_head;
}
-
-/* A small stub to get us past the arg-passing pinhole of catch_errors. */
-
-static int
-symbol_add_stub (void *arg)
+static void
+symbol_add_stub (struct so_list *so, int defer_bp_reset)
{
- struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
struct section_addr_info *sap;
+ int flags = OBJF_SHARED | OBJF_KEEPBFD;
/* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile)
{
if (strcmp (so->objfile->name, so->so_name) == 0)
- return 1;
+ return;
}
sap = build_section_addr_info_from_section_table (so->sections,
so->sections_end);
+ if (defer_bp_reset)
+ flags |= OBJF_DEFER_BP_RESET;
so->objfile = symbol_file_add_from_bfd (so->abfd, so->from_tty,
- sap, 0, OBJF_SHARED | OBJF_KEEPBFD);
+ sap, 0, flags);
free_section_addr_info (sap);
- return (1);
+ return;
}
/* Read in symbols for shared object SO. If FROM_TTY is non-zero, be
@@ -479,7 +478,7 @@ symbol_add_stub (void *arg)
loaded. */
int
-solib_read_symbols (struct so_list *so, int from_tty)
+solib_read_symbols (struct so_list *so, int from_tty, int defer_bp_reset)
{
if (so->symbols_loaded)
{
@@ -493,15 +492,21 @@ solib_read_symbols (struct so_list *so,
}
else
{
- if (catch_errors (symbol_add_stub, so,
- "Error while reading shared library symbols:\n",
- RETURN_MASK_ALL))
- {
- if (from_tty && print_symbol_loading)
- printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
- so->symbols_loaded = 1;
- return 1;
- }
+ volatile struct gdb_exception exception;
+ TRY_CATCH (exception, RETURN_MASK_ALL)
+ {
+ symbol_add_stub (so, defer_bp_reset);
+ }
+ if (exception.reason != 0)
+ {
+ exception_fprintf (gdb_stderr, exception,
+ "Error while reading shared library symbols:\n");
+ return 0;
+ }
+ if (from_tty && print_symbol_loading)
+ printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
+ so->symbols_loaded = 1;
+ return 1;
}
return 0;
@@ -749,10 +754,13 @@ solib_add (char *pattern, int from_tty,
(readsyms || libpthread_solib_p (gdb));
any_matches = 1;
- if (add_this_solib && solib_read_symbols (gdb, from_tty))
+ if (add_this_solib && solib_read_symbols (gdb, from_tty, 1))
loaded_any_symbols = 1;
}
+ if (loaded_any_symbols)
+ breakpoint_re_set ();
+
if (from_tty && pattern && ! any_matches)
printf_unfiltered
("No loaded shared libraries match the pattern `%s'.\n", pattern);
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.50
diff -u -p -u -r1.50 symfile.h
--- symfile.h 22 May 2009 23:49:14 -0000 1.50
+++ symfile.h 9 Jun 2009 00:49:31 -0000
@@ -214,7 +214,7 @@ extern void syms_from_objfile (struct ob
struct section_addr_info *,
struct section_offsets *, int, int, int);
-extern void new_symfile_objfile (struct objfile *, int, int);
+extern void new_symfile_objfile (struct objfile *, int, int, int);
extern struct objfile *symbol_file_add (char *, int,
struct section_addr_info *, int, int);
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.230
diff -u -p -u -r1.230 symfile.c
--- symfile.c 4 Jun 2009 00:50:16 -0000 1.230
+++ symfile.c 9 Jun 2009 00:49:31 -0000
@@ -906,7 +906,8 @@ syms_from_objfile (struct objfile *objfi
objfile. */
void
-new_symfile_objfile (struct objfile *objfile, int mainline, int verbo)
+new_symfile_objfile (struct objfile *objfile, int mainline, int verbo,
+ int flags)
{
/* If this is the main symbol file we have to clean up all users of the
@@ -919,7 +920,7 @@ new_symfile_objfile (struct objfile *obj
clear_symtab_users ();
}
- else
+ else if ((flags & OBJF_DEFER_BP_RESET) == 0)
{
breakpoint_re_set_objfile (objfile);
}
@@ -1081,7 +1082,7 @@ symbol_file_add_with_addrs_or_offsets (b
if (objfile->sf == NULL)
return objfile; /* No symbols. */
- new_symfile_objfile (objfile, mainline, from_tty);
+ new_symfile_objfile (objfile, mainline, from_tty, flags);
observer_notify_new_objfile (objfile);
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.59
diff -u -p -u -r1.59 objfiles.h
--- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59
+++ objfiles.h 9 Jun 2009 00:49:31 -0000
@@ -419,6 +419,9 @@ struct objfile
#define OBJF_KEEPBFD (1 << 4) /* Do not delete bfd */
+/* User requested that this objfile not trigger breakpoint reset. */
+
+#define OBJF_DEFER_BP_RESET (1 << 5) /* Defer breakpoint reset. */
/* The object file that the main symbol table was loaded from (e.g. the
argument to the "symbol-file" or "file" command). */
Index: bsd-uthread.c
===================================================================
RCS file: /cvs/src/src/gdb/bsd-uthread.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 bsd-uthread.c
--- bsd-uthread.c 21 May 2009 15:48:41 -0000 1.24
+++ bsd-uthread.c 9 Jun 2009 00:49:31 -0000
@@ -248,7 +248,7 @@ bsd_uthread_solib_loaded (struct so_list
{
if (strncmp (so->so_original_name, *names, strlen (*names)) == 0)
{
- solib_read_symbols (so, so->from_tty);
+ solib_read_symbols (so, so->from_tty, 0);
if (bsd_uthread_activate (so->objfile))
{
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.93
diff -u -p -u -r1.93 rs6000-nat.c
--- rs6000-nat.c 3 Jun 2009 18:50:36 -0000 1.93
+++ rs6000-nat.c 9 Jun 2009 00:49:31 -0000
@@ -692,7 +692,7 @@ objfile_symbol_add (void *arg)
struct objfile *obj = (struct objfile *) arg;
syms_from_objfile (obj, NULL, 0, 0, 0, 0);
- new_symfile_objfile (obj, 0, 0);
+ new_symfile_objfile (obj, 0, 0, 0);
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] Eliminate quadratic slow-down on number of solibs (take 2).
2009-06-09 0:51 [patch] Eliminate quadratic slow-down on number of solibs (take 2) Paul Pluzhnikov
@ 2009-06-15 15:18 ` Paul Pluzhnikov
2009-06-15 22:20 ` Tom Tromey
1 sibling, 0 replies; 6+ messages in thread
From: Paul Pluzhnikov @ 2009-06-15 15:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
On Mon, Jun 8, 2009 at 5:50 PM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:
> How about attached patch then?
...
> 2009-06-08 Paul Pluzhnikov <ppluzhnikov@google.com>
>
> * solib.c (symbol_add_stub): Add DEFER_BP_RESET parameter.
> (solib_read_symbols): Add DEFER_BP_RESET parameter.
...
Ping?
--
Paul Pluzhnikov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] Eliminate quadratic slow-down on number of solibs (take 2).
2009-06-09 0:51 [patch] Eliminate quadratic slow-down on number of solibs (take 2) Paul Pluzhnikov
2009-06-15 15:18 ` Paul Pluzhnikov
@ 2009-06-15 22:20 ` Tom Tromey
2009-06-16 1:29 ` Paul Pluzhnikov
1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-06-15 22:20 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: gdb-patches
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
Thanks for the ping.
Tom> These are all just forwarding calls, basically overloads.
Tom> You could add a new overload just for this purpose.
Paul> But they may call themselves recursively.
Paul> I've added a bit to OBJF_* flags instead.
I think this mixes two things: flags to the call, and flags affecting
the resulting objfile.
I'd be happier with a new argument, or changing the name and use of
the 'from_tty' argument -- e.g., adding a new enum and expanding this
argument to be flags-for-the-call. Either of these is quite a bit
bigger, but mostly mechanical.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] Eliminate quadratic slow-down on number of solibs (take 2).
2009-06-15 22:20 ` Tom Tromey
@ 2009-06-16 1:29 ` Paul Pluzhnikov
2009-06-16 17:32 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Paul Pluzhnikov @ 2009-06-16 1:29 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
On Mon, Jun 15, 2009 at 3:20 PM, Tom Tromey<tromey@redhat.com> wrote:
> I'd be happier with a new argument, or changing the name and use of
> the 'from_tty' argument -- e.g., adding a new enum and expanding this
> argument to be flags-for-the-call.
I selected the latter option.
Attached patch tested on Linux/x86_64 with no regressions.
Thanks,
--
Paul Pluzhnikov
2009-06-15 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib.c (symbol_add_stub): New FLAGS parameter.
(solib_read_symbols): FROM_TTY -> FLAGS, call symbol_add_stub
directly.
(solib_add): Defer breakpoint_re_set until after all solibs.
* bsd-uthread.c (bsd_uthread_solib_loaded): Adjust.
* rs6000-nat.c (objfile_symbol_add): Adjust.
* symfile.c (syms_from_objfile): Merge parameters into ADD_FLAGS.
(new_symfile_objfile): Likewise.
(symbol_file_add_with_addrs_or_offsets): Likewise.
(symbol_file_add_from_bfd): Likewise.
(symbol_file_add): Likewise.
* symfile.h (enum symfile_add_flags): New. Adjust prototypes.
* symfile-mem.c (symbol_file_add_from_memory): Adjust.
* windows-nat.c (safe_symbol_file_add_stub): Adjust.
* machoread.c (macho_oso_symfile, macho_symfile_read): Adjust.
[-- Attachment #2: gdb-breakpoint-20090615.txt --]
[-- Type: text/plain, Size: 18100 bytes --]
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.119
diff -u -p -u -r1.119 solib.c
--- solib.c 3 Jun 2009 18:50:36 -0000 1.119
+++ solib.c 16 Jun 2009 01:14:37 -0000
@@ -448,39 +448,37 @@ master_so_list (void)
return so_list_head;
}
-
-/* A small stub to get us past the arg-passing pinhole of catch_errors. */
-
-static int
-symbol_add_stub (void *arg)
+static void
+symbol_add_stub (struct so_list *so, int flags)
{
- struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
struct section_addr_info *sap;
/* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile)
{
if (strcmp (so->objfile->name, so->so_name) == 0)
- return 1;
+ return;
}
sap = build_section_addr_info_from_section_table (so->sections,
so->sections_end);
- so->objfile = symbol_file_add_from_bfd (so->abfd, so->from_tty,
- sap, 0, OBJF_SHARED | OBJF_KEEPBFD);
+ so->objfile = symbol_file_add_from_bfd (so->abfd, flags,
+ sap, OBJF_SHARED | OBJF_KEEPBFD);
free_section_addr_info (sap);
- return (1);
+ return;
}
-/* Read in symbols for shared object SO. If FROM_TTY is non-zero, be
- chatty about it. Return non-zero if any symbols were actually
+/* Read in symbols for shared object SO. If SYMFILE_VERBOSE is set in FLAGS,
+ be chatty about it. Return non-zero if any symbols were actually
loaded. */
int
-solib_read_symbols (struct so_list *so, int from_tty)
+solib_read_symbols (struct so_list *so, int flags)
{
+ const int from_tty = flags & SYMFILE_VERBOSE;
+
if (so->symbols_loaded)
{
if (from_tty)
@@ -493,15 +491,21 @@ solib_read_symbols (struct so_list *so,
}
else
{
- if (catch_errors (symbol_add_stub, so,
- "Error while reading shared library symbols:\n",
- RETURN_MASK_ALL))
- {
- if (from_tty && print_symbol_loading)
- printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
- so->symbols_loaded = 1;
- return 1;
- }
+ volatile struct gdb_exception exception;
+ TRY_CATCH (exception, RETURN_MASK_ALL)
+ {
+ symbol_add_stub (so, flags);
+ }
+ if (exception.reason != 0)
+ {
+ exception_fprintf (gdb_stderr, exception,
+ "Error while reading shared library symbols:\n");
+ return 0;
+ }
+ if (from_tty && print_symbol_loading)
+ printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
+ so->symbols_loaded = 1;
+ return 1;
}
return 0;
@@ -736,6 +740,8 @@ solib_add (char *pattern, int from_tty,
{
int any_matches = 0;
int loaded_any_symbols = 0;
+ const int flags =
+ SYMFILE_DEFER_BP_RESET | (from_tty ? SYMFILE_VERBOSE : 0);
for (gdb = so_list_head; gdb; gdb = gdb->next)
if (! pattern || re_exec (gdb->so_name))
@@ -749,10 +755,13 @@ solib_add (char *pattern, int from_tty,
(readsyms || libpthread_solib_p (gdb));
any_matches = 1;
- if (add_this_solib && solib_read_symbols (gdb, from_tty))
+ if (add_this_solib && solib_read_symbols (gdb, flags))
loaded_any_symbols = 1;
}
+ if (loaded_any_symbols)
+ breakpoint_re_set ();
+
if (from_tty && pattern && ! any_matches)
printf_unfiltered
("No loaded shared libraries match the pattern `%s'.\n", pattern);
Index: bsd-uthread.c
===================================================================
RCS file: /cvs/src/src/gdb/bsd-uthread.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 bsd-uthread.c
--- bsd-uthread.c 21 May 2009 15:48:41 -0000 1.24
+++ bsd-uthread.c 16 Jun 2009 01:14:37 -0000
@@ -248,7 +248,7 @@ bsd_uthread_solib_loaded (struct so_list
{
if (strncmp (so->so_original_name, *names, strlen (*names)) == 0)
{
- solib_read_symbols (so, so->from_tty);
+ solib_read_symbols (so, so->from_tty ? SYMFILE_VERBOSE : 0);
if (bsd_uthread_activate (so->objfile))
{
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.93
diff -u -p -u -r1.93 rs6000-nat.c
--- rs6000-nat.c 3 Jun 2009 18:50:36 -0000 1.93
+++ rs6000-nat.c 16 Jun 2009 01:14:37 -0000
@@ -691,8 +691,8 @@ objfile_symbol_add (void *arg)
{
struct objfile *obj = (struct objfile *) arg;
- syms_from_objfile (obj, NULL, 0, 0, 0, 0);
- new_symfile_objfile (obj, 0, 0);
+ syms_from_objfile (obj, NULL, 0, 0, 0);
+ new_symfile_objfile (obj, 0);
return 1;
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.230
diff -u -p -u -r1.230 symfile.c
--- symfile.c 4 Jun 2009 00:50:16 -0000 1.230
+++ symfile.c 16 Jun 2009 01:14:37 -0000
@@ -740,22 +740,20 @@ default_symfile_segments (bfd *abfd)
list any more; all we have is the section offset table.) If
OFFSETS is non-zero, ADDRS must be zero.
- MAINLINE is nonzero if this is the main symbol file, or zero if
- it's an extra symbol file such as dynamically loaded code.
-
- VERBO is nonzero if the caller has printed a verbose message about
- the symbol reading (and complaints can be more terse about it). */
+ ADD_FLAGS encodes verbosity level, whether this is main symbol or
+ an extra symbol file such as dynamically loaded code, and wether
+ breakpoint reset should be deferred. */
void
syms_from_objfile (struct objfile *objfile,
struct section_addr_info *addrs,
struct section_offsets *offsets,
int num_offsets,
- int mainline,
- int verbo)
+ int add_flags)
{
struct section_addr_info *local_addr = NULL;
struct cleanup *old_chain;
+ const int mainline = add_flags & SYMFILE_MAINLINE;
gdb_assert (! (addrs && offsets));
@@ -875,7 +873,7 @@ syms_from_objfile (struct objfile *objfi
initial symbol reading for this file. */
(*objfile->sf->sym_init) (objfile);
- clear_complaints (&symfile_complaints, 1, verbo);
+ clear_complaints (&symfile_complaints, 1, add_flags & SYMFILE_VERBOSE);
if (addrs)
(*objfile->sf->sym_offsets) (objfile, addrs);
@@ -906,26 +904,26 @@ syms_from_objfile (struct objfile *objfi
objfile. */
void
-new_symfile_objfile (struct objfile *objfile, int mainline, int verbo)
+new_symfile_objfile (struct objfile *objfile, int add_flags)
{
/* If this is the main symbol file we have to clean up all users of the
old main symbol file. Otherwise it is sufficient to fixup all the
breakpoints that may have been redefined by this symbol file. */
- if (mainline)
+ if (add_flags & SYMFILE_MAINLINE)
{
/* OK, make it the "real" symbol file. */
symfile_objfile = objfile;
clear_symtab_users ();
}
- else
+ else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
{
breakpoint_re_set_objfile (objfile);
}
/* We're done reading the symbol file; finish off complaints. */
- clear_complaints (&symfile_complaints, 0, verbo);
+ clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE);
}
/* Process a symbol file, as either the main file or as a dynamically
@@ -934,23 +932,23 @@ new_symfile_objfile (struct objfile *obj
ABFD is a BFD already open on the file, as from symfile_bfd_open.
This BFD will be closed on error, and is always consumed by this function.
- FROM_TTY says how verbose to be.
-
- MAINLINE specifies whether this is the main symbol file, or whether
- it's an extra symbol file such as dynamically loaded code.
+ ADD_FLAGS encodes verbosity, whether this is main symbol file or
+ extra, such as dynamically loaded code, and what to do with breakpoins.
ADDRS, OFFSETS, and NUM_OFFSETS are as described for
- syms_from_objfile, above. ADDRS is ignored when MAINLINE is
- non-zero.
+ syms_from_objfile, above.
+ ADDRS is ignored when SYMFILE_MAINLINE bit is set in ADD_FLAGS.
Upon success, returns a pointer to the objfile that was added.
Upon failure, jumps back to command level (never returns). */
+
static struct objfile *
-symbol_file_add_with_addrs_or_offsets (bfd *abfd, int from_tty,
+symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+ int add_flags,
struct section_addr_info *addrs,
struct section_offsets *offsets,
int num_offsets,
- int mainline, int flags)
+ int flags)
{
struct objfile *objfile;
struct partial_symtab *psymtab;
@@ -958,6 +956,7 @@ symbol_file_add_with_addrs_or_offsets (b
struct section_addr_info *orig_addrs = NULL;
struct cleanup *my_cleanups;
const char *name = bfd_get_filename (abfd);
+ const int from_tty = add_flags & SYMFILE_VERBOSE;
my_cleanups = make_cleanup_bfd_close (abfd);
@@ -965,7 +964,7 @@ symbol_file_add_with_addrs_or_offsets (b
interactively wiping out any existing symbols. */
if ((have_full_symbols () || have_partial_symbols ())
- && mainline
+ && (add_flags & SYMFILE_MAINLINE)
&& from_tty
&& !query (_("Load new symbol table from \"%s\"? "), name))
error (_("Not confirmed."));
@@ -997,7 +996,7 @@ symbol_file_add_with_addrs_or_offsets (b
}
}
syms_from_objfile (objfile, addrs, offsets, num_offsets,
- mainline, from_tty);
+ add_flags);
/* We now have at least a partial symbol table. Check to see if the
user requested that all symbols be read on initial access via either
@@ -1031,12 +1030,12 @@ symbol_file_add_with_addrs_or_offsets (b
if (addrs != NULL)
{
objfile->separate_debug_objfile
- = symbol_file_add (debugfile, from_tty, orig_addrs, 0, flags);
+ = symbol_file_add (debugfile, add_flags, orig_addrs, flags);
}
else
{
objfile->separate_debug_objfile
- = symbol_file_add (debugfile, from_tty, NULL, 0, flags);
+ = symbol_file_add (debugfile, add_flags, NULL, flags);
}
objfile->separate_debug_objfile->separate_debug_objfile_backlink
= objfile;
@@ -1081,7 +1080,7 @@ symbol_file_add_with_addrs_or_offsets (b
if (objfile->sf == NULL)
return objfile; /* No symbols. */
- new_symfile_objfile (objfile, mainline, from_tty);
+ new_symfile_objfile (objfile, add_flags);
observer_notify_new_objfile (objfile);
@@ -1096,13 +1095,12 @@ symbol_file_add_with_addrs_or_offsets (b
See symbol_file_add_with_addrs_or_offsets's comments for
details. */
struct objfile *
-symbol_file_add_from_bfd (bfd *abfd, int from_tty,
+symbol_file_add_from_bfd (bfd *abfd, int add_flags,
struct section_addr_info *addrs,
- int mainline, int flags)
+ int flags)
{
- return symbol_file_add_with_addrs_or_offsets (abfd,
- from_tty, addrs, 0, 0,
- mainline, flags);
+ return symbol_file_add_with_addrs_or_offsets (abfd, add_flags, addrs, 0, 0,
+ flags);
}
@@ -1110,11 +1108,11 @@ symbol_file_add_from_bfd (bfd *abfd, int
loaded file. See symbol_file_add_with_addrs_or_offsets's comments
for details. */
struct objfile *
-symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs,
- int mainline, int flags)
+symbol_file_add (char *name, int add_flags, struct section_addr_info *addrs,
+ int flags)
{
- return symbol_file_add_from_bfd (symfile_bfd_open (name), from_tty,
- addrs, mainline, flags);
+ return symbol_file_add_from_bfd (symfile_bfd_open (name), add_flags, addrs,
+ flags);
}
@@ -1135,7 +1133,8 @@ symbol_file_add_main (char *args, int fr
static void
symbol_file_add_main_1 (char *args, int from_tty, int flags)
{
- symbol_file_add (args, from_tty, NULL, 1, flags);
+ const int add_flags = SYMFILE_MAINLINE | (from_tty ? SYMFILE_VERBOSE : 0);
+ symbol_file_add (args, add_flags, NULL, flags);
/* Getting new symbols may change our opinion about
what is frameless. */
@@ -2224,7 +2223,8 @@ add_symbol_file_command (char *args, int
if (from_tty && (!query ("%s", "")))
error (_("Not confirmed."));
- symbol_file_add (filename, from_tty, section_addrs, 0, flags);
+ symbol_file_add (filename, from_tty ? SYMFILE_VERBOSE : 0,
+ section_addrs, flags);
/* Getting new symbols may change our opinion about what is
frameless. */
@@ -2506,10 +2506,9 @@ reread_separate_symbols (struct objfile
objfile->separate_debug_objfile
= (symbol_file_add_with_addrs_or_offsets
(symfile_bfd_open (debug_file),
- info_verbose, /* from_tty: Don't override the default. */
+ info_verbose ? SYMFILE_VERBOSE : 0,
0, /* No addr table. */
objfile->section_offsets, objfile->num_sections,
- 0, /* Not mainline. See comments about this above. */
objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW
| OBJF_USERLOADED)));
objfile->separate_debug_objfile->separate_debug_objfile_backlink
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.50
diff -u -p -u -r1.50 symfile.h
--- symfile.h 22 May 2009 23:49:14 -0000 1.50
+++ symfile.h 16 Jun 2009 01:14:37 -0000
@@ -210,18 +210,25 @@ extern int free_named_symtabs (char *);
extern void add_symtab_fns (struct sym_fns *);
+enum symfile_add_flags
+ {
+ SYMFILE_VERBOSE = 1 << 1,
+ SYMFILE_MAINLINE = 1 << 2,
+ SYMFILE_DEFER_BP_RESET = 1 << 3
+ };
+
extern void syms_from_objfile (struct objfile *,
struct section_addr_info *,
- struct section_offsets *, int, int, int);
+ struct section_offsets *, int, int);
-extern void new_symfile_objfile (struct objfile *, int, int);
+extern void new_symfile_objfile (struct objfile *, int);
extern struct objfile *symbol_file_add (char *, int,
- struct section_addr_info *, int, int);
+ struct section_addr_info *, int);
extern struct objfile *symbol_file_add_from_bfd (bfd *, int,
struct section_addr_info *,
- int, int);
+ int);
/* Create a new section_addr_info, with room for NUM_SECTIONS. */
Index: symfile-mem.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile-mem.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 symfile-mem.c
--- symfile-mem.c 21 Feb 2009 16:14:49 -0000 1.17
+++ symfile-mem.c 16 Jun 2009 01:14:38 -0000
@@ -107,8 +107,8 @@ symbol_file_add_from_memory (struct bfd
++i;
}
- objf = symbol_file_add_from_bfd (nbfd, from_tty,
- sai, 0, OBJF_SHARED);
+ objf = symbol_file_add_from_bfd (nbfd, from_tty ? SYMFILE_VERBOSE : 0,
+ sai, OBJF_SHARED);
/* This might change our ideas about frames already looked at. */
reinit_frame_cache ();
Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.193
diff -u -p -u -r1.193 windows-nat.c
--- windows-nat.c 7 Jun 2009 16:46:48 -0000 1.193
+++ windows-nat.c 16 Jun 2009 01:14:38 -0000
@@ -556,7 +556,9 @@ static int
safe_symbol_file_add_stub (void *argv)
{
#define p ((struct safe_symbol_file_add_args *) argv)
- p->ret = symbol_file_add (p->name, p->from_tty, p->addrs, p->mainline, p->flags);
+ const int add_flags = (p->from_tty ? SYMFILE_VERBOSE : 0)
+ | (p->mainline ? SYMFILE_MAINLINE : 0);
+ p->ret = symbol_file_add (p->name, add_flags, p->addrs, p->flags);
return !!p->ret;
#undef p
}
Index: spu-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-linux-nat.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 spu-linux-nat.c
--- spu-linux-nat.c 21 May 2009 15:48:41 -0000 1.21
+++ spu-linux-nat.c 16 Jun 2009 01:14:38 -0000
@@ -372,7 +372,8 @@ spu_symbol_file_add_from_memory (int inf
/* Open BFD representing SPE executable and read its symbols. */
nbfd = spu_bfd_open (addr);
if (nbfd)
- symbol_file_add_from_bfd (nbfd, 1, NULL, 1, 0);
+ symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
+ NULL, 0);
}
@@ -600,4 +601,3 @@ _initialize_spu_nat (void)
/* Register SPU target. */
add_target (t);
}
-
Index: machoread.c
===================================================================
RCS file: /cvs/src/src/gdb/machoread.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 machoread.c
--- machoread.c 4 Feb 2009 08:47:56 -0000 1.3
+++ machoread.c 16 Jun 2009 01:14:38 -0000
@@ -406,7 +406,7 @@ macho_oso_symfile (struct objfile *main_
bfd_close (member_bfd);
}
else
- symbol_file_add_from_bfd (member_bfd, 0, addrs, 0, 0);
+ symbol_file_add_from_bfd (member_bfd, 0, addrs, 0);
}
else
{
@@ -429,7 +429,7 @@ macho_oso_symfile (struct objfile *main_
continue;
}
- symbol_file_add_from_bfd (abfd, 0, addrs, 0, 0);
+ symbol_file_add_from_bfd (abfd, 0, addrs, 0);
}
xfree (oso->symbols);
xfree (oso->offsets);
@@ -592,7 +592,7 @@ macho_symfile_read (struct objfile *objf
oso_vector = NULL;
/* Now recurse: read dwarf from dsym. */
- symbol_file_add_from_bfd (dsym_bfd, 0, NULL, 0, 0);
+ symbol_file_add_from_bfd (dsym_bfd, 0, NULL, 0);
/* Don't try to read dwarf2 from main file or shared libraries. */
return;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] Eliminate quadratic slow-down on number of solibs (take 2).
2009-06-16 1:29 ` Paul Pluzhnikov
@ 2009-06-16 17:32 ` Tom Tromey
2009-06-16 18:51 ` Paul Pluzhnikov
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-06-16 17:32 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: gdb-patches
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
Paul> 2009-06-15 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul> * solib.c (symbol_add_stub): New FLAGS parameter.
[...]
Just two nits.
Paul> +enum symfile_add_flags
Paul> + {
Paul> + SYMFILE_VERBOSE = 1 << 1,
Paul> + SYMFILE_MAINLINE = 1 << 2,
Paul> + SYMFILE_DEFER_BP_RESET = 1 << 3
Paul> + };
This needs a comment before the enum, and ideally also a comment
explaining each constant.
Paul> Index: windows-nat.c
[...]
Paul> + const int add_flags = (p->from_tty ? SYMFILE_VERBOSE : 0)
Paul> + | (p->mainline ? SYMFILE_MAINLINE : 0);
This needs parens around the whole RHS, and the continuation line
should be indented.
Ok with these changes. Thanks for persevering.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] Eliminate quadratic slow-down on number of solibs (take 2).
2009-06-16 17:32 ` Tom Tromey
@ 2009-06-16 18:51 ` Paul Pluzhnikov
0 siblings, 0 replies; 6+ messages in thread
From: Paul Pluzhnikov @ 2009-06-16 18:51 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Tue, Jun 16, 2009 at 10:31 AM, Tom Tromey<tromey@redhat.com> wrote:
> Ok with these changes.
Fixed and committed.
Thanks,
--
Paul Pluzhnikov
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-16 18:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-09 0:51 [patch] Eliminate quadratic slow-down on number of solibs (take 2) Paul Pluzhnikov
2009-06-15 15:18 ` Paul Pluzhnikov
2009-06-15 22:20 ` Tom Tromey
2009-06-16 1:29 ` Paul Pluzhnikov
2009-06-16 17:32 ` Tom Tromey
2009-06-16 18:51 ` Paul Pluzhnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox