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 Thu, Dec 27, 2012 at 2:51 PM, Stan Shebs <stanshebs@earthlink.net> wrote:
> On 12/26/12 1:37 AM, Yao Qi wrote:
>>
>> Hi,
>> I happen to read the following part in psymtab.c:init_psymbol_list,
>>
>>    /* Current best guess is that approximately a twentieth
>>       of the total symbols (in a debugging file) are global or static
>>       oriented symbols.  */
>>
>>    objfile->global_psymbols.size = total_symbols / 10;
>>    objfile->static_psymbols.size = total_symbols / 10;
>>
>> and think the code is inconsistent to the comment (twentieth vs. '/ 10').
>> It should be "tenth" instead of "twentieth" in comment.  Of course,
>> we can update constant 10 to 20, but it is safe to change comment rather
>> than the code.
>
>
> 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
>
>   [...] oriented symbols, then multiply that by slop factor of two. */
>
>
> (It took me a while to realize that the discrepancy was probably
> intentional, so definitely want to clarify the comment.)

Doing any calculation here seems a bit odd:
- the arrays are per-objfile
- the calculation is per-CU
- the calculation is only done for the first CU


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