* [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
@ 2001-12-06 13:38 Andrew Cagney
2001-12-06 14:23 ` Elena Zannoni
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2001-12-06 13:38 UTC (permalink / raw)
To: gdb
[-- Attachment #1: Type: text/plain, Size: 35 bytes --]
This might be interesting.
Andrew
[-- Attachment #2: gdb call" very slow on large C++ program --]
[-- Type: message/rfc822, Size: 7897 bytes --]
From: Richard Sharman <richard_sharman@Mitel.COM>
To: bug-gdb@gnu.org
Cc: sharman@sharmanpc.software.Mitel.COM
Subject: gdb "call" very slow on large C++ program; 2 possible patches
Date: Sat, 17 Nov 2001 22:14:28 -0500
Message-ID: <15351.10132.782759.852559@sharmanpc.software.mitel.com>
We have a largish C++ program, and when we use the gdb "call" function
it takes about 12 seconds for GDB to perform the operation.
(The function itself is very quick. In the previous C version of the
program the call was virtually instantaneous.)
I have two patches. The first patch reduced the time to about 5 seconds
for the first call but 2 seconds for the second call; the second patch
reduced to time to about an eigth of a second.
The first patch was to "overload_list_add_symbol" in symtab.c .
This function was taking a lot of time demangling symbols that didn't
match. The patch did two things:
* See if the name to search for matched the beginning of the
mangled name. If it did not, then exit immediately. This saved the
call to cplus_demangle and the xmalloc and free calls.
* Set the "readin" flag after the two for loops in the ALL_PSYMTABS
loop. This catches the cases of files that have no symbols and thus
never get the readin flag set. (This may seem trivial but happened
in 4860 files in our program so was quite significant.)
As mentioned above, this helped signficantly, especially on the second
call.
However, there was still a noticable delay before the called function
was executed. We noticed that the gdb "info func" on the command name
was executed immediately, and wondered why it didn't have the same
delay in finding the function name. We found it was not using the
"make_symbol_overload_list" function, but instead calling
"search_symbols". The second patch was then to "find_overload_match"
in valops.c, to use the "search_symbols" function.
Both patches work for us but I am not at all familiar with the
workings of gdb so do not know how reliable they are. I have no idea
why there appear to be two functions doing essentially the same thing
but one takes 12 seconds and one takes 0.125 seconds.
The second patch makes the first patch unncessary since
make_symbol_overload_list is not called other than in the original
valops.c.
Here are the two patches. They are agains the cvs source as of
14 November checked out using
cvs -z9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -r \
gdb_5_0-2000-04-10-branch gdb+dejagnu
-------------------- Patch 1 --------------------
*** symtab.c.orig Mon Apr 3 22:08:52 2000
--- symtab.c Wed Nov 14 23:23:13 2001
***************
*** 4460,4468 ****
{
int newsize;
int i;
/* Get the demangled name without parameters */
! char *sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
if (!sym_name)
{
sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
--- 4460,4476 ----
{
int newsize;
int i;
+ char *sym_name;
+
+
+ /* skip symbols that cannot match */
+ if (strncmp(SYMBOL_NAME (sym), oload_name, strlen(oload_name)) != 0)
+ {
+ return;
+ }
/* Get the demangled name without parameters */
! sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
if (!sym_name)
{
sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
***************
*** 4567,4574 ****
--- 4575,4590 ----
/* This will cause the symbol table to be read if it has not yet been */
s = PSYMTAB_TO_SYMTAB (ps);
}
+
+ /* If no symbols were found, mark it as read anyway so that
+ we skip it next time. */
+ if (ps && !ps->readin)
+ {
+ ps->readin = 1;
+ }
}
+
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
-------------------------------------------------
-------------------- Patch --------------------
*** valops.c.orig Sun Apr 9 09:02:10 2000
--- valops.c Thu Nov 15 15:25:36 2001
***************
*** 2739,2744 ****
--- 2739,2747 ----
int boffset;
register int jj;
register int ix;
+ struct symbol_search *symbols;
+ struct symbol_search *p;
+ struct cleanup *old_chain;
char *obj_type_name = NULL;
char *func_name = NULL;
***************
*** 2799,2807 ****
return 0;
}
! oload_syms = make_symbol_overload_list (fsym);
! while (oload_syms[++i])
! num_fns++;
if (!num_fns)
error ("Couldn't find function %s", func_name);
}
--- 2802,2821 ----
return 0;
}
! search_symbols (SYMBOL_NAME (fsym), FUNCTIONS_NAMESPACE, 0, (char **) NULL, &symbols);
! old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
! for (p = symbols; p != NULL; p = p->next)
! {
! num_fns++;
! }
! oload_syms = (struct symbol **) xmalloc ((num_fns + 1) * sizeof (struct symbol *));
! i = -1;
! for (p = symbols; p != NULL; p = p->next)
! {
! oload_syms[++i] = p->symbol;
! }
! do_cleanups (old_chain);
!
if (!num_fns)
error ("Couldn't find function %s", func_name);
}
***************
*** 2946,2952 ****
*symp = oload_syms[oload_champ];
free (func_name);
}
!
return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
}
--- 2960,2966 ----
*symp = oload_syms[oload_champ];
free (func_name);
}
! free(oload_syms);
return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
}
-------------------------------------------------
Richard Sharman
_______________________________________________
Bug-gdb mailing list
Bug-gdb@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gdb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
2001-12-06 13:38 [Fwd: gdb "call" very slow on large C++ program; 2 possible patches] Andrew Cagney
@ 2001-12-06 14:23 ` Elena Zannoni
2001-12-07 8:15 ` Elena Zannoni
0 siblings, 1 reply; 6+ messages in thread
From: Elena Zannoni @ 2001-12-06 14:23 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
Andrew Cagney writes:
> This might be interesting.
> Andrew
Hmmm, I am sorry I looked. :-(
I discovered something very strange in symtab.c:make_symbol_overload_list().
What is this function supposed to do with those two for loops over the
psymbols? It is just calling QUIT, and PSYMTAB_TO_SYMTAB over and over
again.
I am afraid somebody did a cvs commit snafu at some point (this would predate
the creation of sourceware).
Those two for loops are noops, as far as I can tell.
I'll dig further, before I actually can make sense of all this.
Your cvs archaeologist,
Elena
> From: Richard Sharman <richard_sharman@Mitel.COM>
> To: bug-gdb@gnu.org
> Cc: sharman@sharmanpc.software.Mitel.COM
> Subject: gdb "call" very slow on large C++ program; 2 possible patches
> Date: Sat, 17 Nov 2001 22:14:28 -0500
> Content-Type: text
>
> We have a largish C++ program, and when we use the gdb "call" function
> it takes about 12 seconds for GDB to perform the operation.
> (The function itself is very quick. In the previous C version of the
> program the call was virtually instantaneous.)
>
> I have two patches. The first patch reduced the time to about 5 seconds
> for the first call but 2 seconds for the second call; the second patch
> reduced to time to about an eigth of a second.
>
> The first patch was to "overload_list_add_symbol" in symtab.c .
> This function was taking a lot of time demangling symbols that didn't
> match. The patch did two things:
>
> * See if the name to search for matched the beginning of the
> mangled name. If it did not, then exit immediately. This saved the
> call to cplus_demangle and the xmalloc and free calls.
>
> * Set the "readin" flag after the two for loops in the ALL_PSYMTABS
> loop. This catches the cases of files that have no symbols and thus
> never get the readin flag set. (This may seem trivial but happened
> in 4860 files in our program so was quite significant.)
>
> As mentioned above, this helped signficantly, especially on the second
> call.
>
> However, there was still a noticable delay before the called function
> was executed. We noticed that the gdb "info func" on the command name
> was executed immediately, and wondered why it didn't have the same
> delay in finding the function name. We found it was not using the
> "make_symbol_overload_list" function, but instead calling
> "search_symbols". The second patch was then to "find_overload_match"
> in valops.c, to use the "search_symbols" function.
>
> Both patches work for us but I am not at all familiar with the
> workings of gdb so do not know how reliable they are. I have no idea
> why there appear to be two functions doing essentially the same thing
> but one takes 12 seconds and one takes 0.125 seconds.
>
> The second patch makes the first patch unncessary since
> make_symbol_overload_list is not called other than in the original
> valops.c.
>
> Here are the two patches. They are agains the cvs source as of
> 14 November checked out using
>
> cvs -z9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -r \
> gdb_5_0-2000-04-10-branch gdb+dejagnu
>
>
> -------------------- Patch 1 --------------------
> *** symtab.c.orig Mon Apr 3 22:08:52 2000
> --- symtab.c Wed Nov 14 23:23:13 2001
> ***************
> *** 4460,4468 ****
> {
> int newsize;
> int i;
>
> /* Get the demangled name without parameters */
> ! char *sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
> if (!sym_name)
> {
> sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
> --- 4460,4476 ----
> {
> int newsize;
> int i;
> + char *sym_name;
> +
> +
> + /* skip symbols that cannot match */
> + if (strncmp(SYMBOL_NAME (sym), oload_name, strlen(oload_name)) != 0)
> + {
> + return;
> + }
>
> /* Get the demangled name without parameters */
> ! sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
> if (!sym_name)
> {
> sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
> ***************
> *** 4567,4574 ****
> --- 4575,4590 ----
> /* This will cause the symbol table to be read if it has not yet been */
> s = PSYMTAB_TO_SYMTAB (ps);
> }
> +
> + /* If no symbols were found, mark it as read anyway so that
> + we skip it next time. */
> + if (ps && !ps->readin)
> + {
> + ps->readin = 1;
> + }
> }
>
> +
> /* Search upwards from currently selected frame (so that we can
> complete on local vars. */
>
> -------------------------------------------------
>
> -------------------- Patch --------------------
> *** valops.c.orig Sun Apr 9 09:02:10 2000
> --- valops.c Thu Nov 15 15:25:36 2001
> ***************
> *** 2739,2744 ****
> --- 2739,2747 ----
> int boffset;
> register int jj;
> register int ix;
> + struct symbol_search *symbols;
> + struct symbol_search *p;
> + struct cleanup *old_chain;
>
> char *obj_type_name = NULL;
> char *func_name = NULL;
> ***************
> *** 2799,2807 ****
> return 0;
> }
>
> ! oload_syms = make_symbol_overload_list (fsym);
> ! while (oload_syms[++i])
> ! num_fns++;
> if (!num_fns)
> error ("Couldn't find function %s", func_name);
> }
> --- 2802,2821 ----
> return 0;
> }
>
> ! search_symbols (SYMBOL_NAME (fsym), FUNCTIONS_NAMESPACE, 0, (char **) NULL, &symbols);
> ! old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
> ! for (p = symbols; p != NULL; p = p->next)
> ! {
> ! num_fns++;
> ! }
> ! oload_syms = (struct symbol **) xmalloc ((num_fns + 1) * sizeof (struct symbol *));
> ! i = -1;
> ! for (p = symbols; p != NULL; p = p->next)
> ! {
> ! oload_syms[++i] = p->symbol;
> ! }
> ! do_cleanups (old_chain);
> !
> if (!num_fns)
> error ("Couldn't find function %s", func_name);
> }
> ***************
> *** 2946,2952 ****
> *symp = oload_syms[oload_champ];
> free (func_name);
> }
> !
> return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
> }
>
> --- 2960,2966 ----
> *symp = oload_syms[oload_champ];
> free (func_name);
> }
> ! free(oload_syms);
> return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
> }
>
> -------------------------------------------------
>
>
> Richard Sharman
>
> _______________________________________________
> Bug-gdb mailing list
> Bug-gdb@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-gdb
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
2001-12-06 14:23 ` Elena Zannoni
@ 2001-12-07 8:15 ` Elena Zannoni
2001-12-07 9:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Elena Zannoni @ 2001-12-07 8:15 UTC (permalink / raw)
To: gdb; +Cc: drow
Elena Zannoni writes:
> Andrew Cagney writes:
> > This might be interesting.
> > Andrew
>
> Hmmm, I am sorry I looked. :-(
> I discovered something very strange in symtab.c:make_symbol_overload_list().
>
> What is this function supposed to do with those two for loops over the
> psymbols? It is just calling QUIT, and PSYMTAB_TO_SYMTAB over and over
> again.
>
> I am afraid somebody did a cvs commit snafu at some point (this would predate
> the creation of sourceware).
> Those two for loops are noops, as far as I can tell.
>
> I'll dig further, before I actually can make sense of all this.
>
> Your cvs archaeologist,
> Elena
>
Yes, something like that happened. I am thinking to send a patch to
restore some sanity to this function. But...
...actually, I think that if search_symbols on FUNCTION_NAMESPACES is
equivalent to make_symbol_overload_list(), we could just get rid of
make_symbol_overload_list() *and* overload_list_add_symbol().
It would be nice to clean this up.
Daniel, does search_symbols produces a correct overload list? At first
sight it would look so.
Elena
>
> > From: Richard Sharman <richard_sharman@Mitel.COM>
> > To: bug-gdb@gnu.org
> > Cc: sharman@sharmanpc.software.Mitel.COM
> > Subject: gdb "call" very slow on large C++ program; 2 possible patches
> > Date: Sat, 17 Nov 2001 22:14:28 -0500
> > Content-Type: text
> >
> > We have a largish C++ program, and when we use the gdb "call" function
> > it takes about 12 seconds for GDB to perform the operation.
> > (The function itself is very quick. In the previous C version of the
> > program the call was virtually instantaneous.)
> >
> > I have two patches. The first patch reduced the time to about 5 seconds
> > for the first call but 2 seconds for the second call; the second patch
> > reduced to time to about an eigth of a second.
> >
> > The first patch was to "overload_list_add_symbol" in symtab.c .
> > This function was taking a lot of time demangling symbols that didn't
> > match. The patch did two things:
> >
> > * See if the name to search for matched the beginning of the
> > mangled name. If it did not, then exit immediately. This saved the
> > call to cplus_demangle and the xmalloc and free calls.
> >
> > * Set the "readin" flag after the two for loops in the ALL_PSYMTABS
> > loop. This catches the cases of files that have no symbols and thus
> > never get the readin flag set. (This may seem trivial but happened
> > in 4860 files in our program so was quite significant.)
> >
> > As mentioned above, this helped signficantly, especially on the second
> > call.
> >
> > However, there was still a noticable delay before the called function
> > was executed. We noticed that the gdb "info func" on the command name
> > was executed immediately, and wondered why it didn't have the same
> > delay in finding the function name. We found it was not using the
> > "make_symbol_overload_list" function, but instead calling
> > "search_symbols". The second patch was then to "find_overload_match"
> > in valops.c, to use the "search_symbols" function.
> >
> > Both patches work for us but I am not at all familiar with the
> > workings of gdb so do not know how reliable they are. I have no idea
> > why there appear to be two functions doing essentially the same thing
> > but one takes 12 seconds and one takes 0.125 seconds.
> >
> > The second patch makes the first patch unncessary since
> > make_symbol_overload_list is not called other than in the original
> > valops.c.
> >
> > Here are the two patches. They are agains the cvs source as of
> > 14 November checked out using
> >
> > cvs -z9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -r \
> > gdb_5_0-2000-04-10-branch gdb+dejagnu
> >
> >
> > -------------------- Patch 1 --------------------
> > *** symtab.c.orig Mon Apr 3 22:08:52 2000
> > --- symtab.c Wed Nov 14 23:23:13 2001
> > ***************
> > *** 4460,4468 ****
> > {
> > int newsize;
> > int i;
> >
> > /* Get the demangled name without parameters */
> > ! char *sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
> > if (!sym_name)
> > {
> > sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
> > --- 4460,4476 ----
> > {
> > int newsize;
> > int i;
> > + char *sym_name;
> > +
> > +
> > + /* skip symbols that cannot match */
> > + if (strncmp(SYMBOL_NAME (sym), oload_name, strlen(oload_name)) != 0)
> > + {
> > + return;
> > + }
> >
> > /* Get the demangled name without parameters */
> > ! sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
> > if (!sym_name)
> > {
> > sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
> > ***************
> > *** 4567,4574 ****
> > --- 4575,4590 ----
> > /* This will cause the symbol table to be read if it has not yet been */
> > s = PSYMTAB_TO_SYMTAB (ps);
> > }
> > +
> > + /* If no symbols were found, mark it as read anyway so that
> > + we skip it next time. */
> > + if (ps && !ps->readin)
> > + {
> > + ps->readin = 1;
> > + }
> > }
> >
> > +
> > /* Search upwards from currently selected frame (so that we can
> > complete on local vars. */
> >
> > -------------------------------------------------
> >
> > -------------------- Patch --------------------
> > *** valops.c.orig Sun Apr 9 09:02:10 2000
> > --- valops.c Thu Nov 15 15:25:36 2001
> > ***************
> > *** 2739,2744 ****
> > --- 2739,2747 ----
> > int boffset;
> > register int jj;
> > register int ix;
> > + struct symbol_search *symbols;
> > + struct symbol_search *p;
> > + struct cleanup *old_chain;
> >
> > char *obj_type_name = NULL;
> > char *func_name = NULL;
> > ***************
> > *** 2799,2807 ****
> > return 0;
> > }
> >
> > ! oload_syms = make_symbol_overload_list (fsym);
> > ! while (oload_syms[++i])
> > ! num_fns++;
> > if (!num_fns)
> > error ("Couldn't find function %s", func_name);
> > }
> > --- 2802,2821 ----
> > return 0;
> > }
> >
> > ! search_symbols (SYMBOL_NAME (fsym), FUNCTIONS_NAMESPACE, 0, (char **) NULL, &symbols);
> > ! old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
> > ! for (p = symbols; p != NULL; p = p->next)
> > ! {
> > ! num_fns++;
> > ! }
> > ! oload_syms = (struct symbol **) xmalloc ((num_fns + 1) * sizeof (struct symbol *));
> > ! i = -1;
> > ! for (p = symbols; p != NULL; p = p->next)
> > ! {
> > ! oload_syms[++i] = p->symbol;
> > ! }
> > ! do_cleanups (old_chain);
> > !
> > if (!num_fns)
> > error ("Couldn't find function %s", func_name);
> > }
> > ***************
> > *** 2946,2952 ****
> > *symp = oload_syms[oload_champ];
> > free (func_name);
> > }
> > !
> > return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
> > }
> >
> > --- 2960,2966 ----
> > *symp = oload_syms[oload_champ];
> > free (func_name);
> > }
> > ! free(oload_syms);
> > return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
> > }
> >
> > -------------------------------------------------
> >
> >
> > Richard Sharman
> >
> > _______________________________________________
> > Bug-gdb mailing list
> > Bug-gdb@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-gdb
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
2001-12-07 8:15 ` Elena Zannoni
@ 2001-12-07 9:30 ` Daniel Jacobowitz
2001-12-07 10:03 ` Elena Zannoni
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2001-12-07 9:30 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb
On Fri, Dec 07, 2001 at 11:21:32AM -0500, Elena Zannoni wrote:
> Yes, something like that happened. I am thinking to send a patch to
> restore some sanity to this function. But...
>
> ...actually, I think that if search_symbols on FUNCTION_NAMESPACES is
> equivalent to make_symbol_overload_list(), we could just get rid of
> make_symbol_overload_list() *and* overload_list_add_symbol().
>
> It would be nice to clean this up.
>
> Daniel, does search_symbols produces a correct overload list? At first
> sight it would look so.
Well, I'm not immediately familiar with this code. At first thought,
there might be some complexity because search_symbols takes a regexp,
but that's easily resolvable. More importantly,
make_symbol_overload_list respects scope. So no, the two are not
equivalent.
I found at least one more bug in overload_list_add_symbol (extraneous
realloc calls) while looking this over, though. I also understand
where those loops came from, more or less; see make_completion_list.
This function (and its comments) need some housecleaning.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
2001-12-07 9:30 ` Daniel Jacobowitz
@ 2001-12-07 10:03 ` Elena Zannoni
2001-12-07 10:11 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Elena Zannoni @ 2001-12-07 10:03 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Elena Zannoni, gdb
Daniel Jacobowitz writes:
> On Fri, Dec 07, 2001 at 11:21:32AM -0500, Elena Zannoni wrote:
> > Yes, something like that happened. I am thinking to send a patch to
> > restore some sanity to this function. But...
> >
> > ...actually, I think that if search_symbols on FUNCTION_NAMESPACES is
> > equivalent to make_symbol_overload_list(), we could just get rid of
> > make_symbol_overload_list() *and* overload_list_add_symbol().
> >
> > It would be nice to clean this up.
> >
> > Daniel, does search_symbols produces a correct overload list? At first
> > sight it would look so.
>
> Well, I'm not immediately familiar with this code. At first thought,
> there might be some complexity because search_symbols takes a regexp,
> but that's easily resolvable. More importantly,
> make_symbol_overload_list respects scope. So no, the two are not
> equivalent.
>
I was looking at the fact that make_symbol_overload_list is used only
for c++ non-member functions, and that search_symbols limits the
search to functions.
> I found at least one more bug in overload_list_add_symbol (extraneous
> realloc calls) while looking this over, though. I also understand
> where those loops came from, more or less; see make_completion_list.
> This function (and its comments) need some housecleaning.
>
Yes, there were calls (which were wrong) to overload_list_add_symbol,
in each loop. Sometimes ago, the #if 0 was lost, and so were the calls
in the loops.
Elena
/* Comment and #if 0 from Rajiv Mirani <mirani@cup.hp.com>.
However, leaving #if 0's around is uncool. We need to figure out
what this is really trying to do, decide whether we want that,
and either fix it or delete it. --- Jim Blandy, Mar 1999 */
/* ??? RM: What in hell is this? overload_list_add_symbol expects a symbol,
* not a partial_symbol or a minimal_symbol. And it looks at the type field
* of the symbol, and we don't know the type of minimal and partial symbols
*/
#if 0
/* Look through the partial symtabs for all symbols which begin
by matching OLOAD_NAME. Add each one that you find to the list. */
ALL_PSYMTABS (objfile, ps)
{
/* If the psymtab's been read in we'll get it when we search
through the blockvector. */
if (ps->readin) continue;
for (psym = objfile->global_psymbols.list + ps->globals_offset;
psym < (objfile->global_psymbols.list + ps->globals_offset
+ ps->n_global_syms);
psym++)
{
/* If interrupted, then quit. */
QUIT;
overload_list_add_symbol (*psym, oload_name);
}
for (psym = objfile->static_psymbols.list + ps->statics_offset;
psym < (objfile->static_psymbols.list + ps->statics_offset
+ ps->n_static_syms);
psym++)
{
QUIT;
overload_list_add_symbol (*psym, oload_name);
}
}
/* At this point scan through the misc symbol vectors and add each
symbol you find to the list. Eventually we want to ignore
anything that isn't a text symbol (everything else will be
handled by the psymtab code above). */
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
overload_list_add_symbol (msymbol, oload_name);
}
#endif
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Fwd: gdb "call" very slow on large C++ program; 2 possible patches]
2001-12-07 10:03 ` Elena Zannoni
@ 2001-12-07 10:11 ` Daniel Jacobowitz
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2001-12-07 10:11 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb
On Fri, Dec 07, 2001 at 01:09:44PM -0500, Elena Zannoni wrote:
> Daniel Jacobowitz writes:
> > On Fri, Dec 07, 2001 at 11:21:32AM -0500, Elena Zannoni wrote:
> > > Yes, something like that happened. I am thinking to send a patch to
> > > restore some sanity to this function. But...
> > >
> > > ...actually, I think that if search_symbols on FUNCTION_NAMESPACES is
> > > equivalent to make_symbol_overload_list(), we could just get rid of
> > > make_symbol_overload_list() *and* overload_list_add_symbol().
> > >
> > > It would be nice to clean this up.
> > >
> > > Daniel, does search_symbols produces a correct overload list? At first
> > > sight it would look so.
> >
> > Well, I'm not immediately familiar with this code. At first thought,
> > there might be some complexity because search_symbols takes a regexp,
> > but that's easily resolvable. More importantly,
> > make_symbol_overload_list respects scope. So no, the two are not
> > equivalent.
> >
>
> I was looking at the fact that make_symbol_overload_list is used only
> for c++ non-member functions, and that search_symbols limits the
> search to functions.
OK. So it looks like we're stuck keeping these functions.
> > I found at least one more bug in overload_list_add_symbol (extraneous
> > realloc calls) while looking this over, though. I also understand
> > where those loops came from, more or less; see make_completion_list.
> > This function (and its comments) need some housecleaning.
> >
>
> Yes, there were calls (which were wrong) to overload_list_add_symbol,
> in each loop. Sometimes ago, the #if 0 was lost, and so were the calls
> in the loops.
I see. I guess we just need
ALL_PSYMTABS (objfile, ps)
{
if (!ps->readin)
s = PSYMTAB_TO_SYMTAB (ps);
}
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-12-07 18:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-06 13:38 [Fwd: gdb "call" very slow on large C++ program; 2 possible patches] Andrew Cagney
2001-12-06 14:23 ` Elena Zannoni
2001-12-07 8:15 ` Elena Zannoni
2001-12-07 9:30 ` Daniel Jacobowitz
2001-12-07 10:03 ` Elena Zannoni
2001-12-07 10:11 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox