This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix inconsistency of code and comments in init_psymbol_list


On 12/28/2012 06:51 AM, Stan Shebs wrote:
> I think the comment is consistent with the code, but maybe a little too
> terse; the goal here is to minimize growing the table, and so we start
> with the 1/20th estimate, multiply by 2 as generic slop factor, and use
> that as starting fraction.  So the comment could just be enhanced to say
> something like
> 

Right, the size of table is doubled when extending the list, but I
thought (when wrote this patch) the size should not be doubled
(1/20 -> 1/10) in initialization.  The number is a heuristic here, and
it has been used for many years.  I am fine to interpret it in this way
(1/20 * 2).

>     [...] oriented symbols, then multiply that by slop factor of two. */
> 

Your suggestion is quite clear.

> 
> (It took me a while to realize that the discrepancy was probably
> intentional, so definitely want to clarify the comment.)

The patch below is to steal your words, and I'll apply it in some days 
if no other comments.

-- 
Yao (éå)

gdb:

2012-12-28  Yao Qi  <yao@codesourcery.com>
	    Stan Shebs  <stan@codesourcery.com>

	* psymtab.c (init_psymbol_list): Clarify the comment.
---
 gdb/psymtab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 409f96b..7cd8b0e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1712,7 +1712,7 @@ init_psymbol_list (struct objfile *objfile, int total_symbols)
 
   /* Current best guess is that approximately a twentieth
      of the total symbols (in a debugging file) are global or static
-     oriented symbols.  */
+     oriented symbols, then multiply that by slop factor of two.  */
 
   objfile->global_psymbols.size = total_symbols / 10;
   objfile->static_psymbols.size = total_symbols / 10;
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]