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]

[RFC] further cleanups in buildsym.c


Hello,

In addition to my previous suggested changes in buildsym.c, I noticed
we have a couple of instance of some code bracketed by "#if 1":

Two are are in finish_block:

> #if 1
>   /* Check to be sure that the blocks have an end address that is
>      greater than starting address */

shortly followed by:

> #if 1
>           /* Check to be sure the blocks are nested as we receive
>              them. If the compiler/assembler/linker work, this just
>              burns a small amount of time.
> 
>              Skip blocks which correspond to a function; they're not
>              physically nested inside this other blocks, only
>              lexically nested.  */

And the last one is in make_blockvector:

> #if 1                           /* FIXME, shut this off after a while
>                                    to speed up symbol reading.  */
>   /* Some compilers output blocks in the wrong order, but we depend on
>      their being in the right order so we can binary search. Check the
>      order and moan about it.  FIXME.  */

I imagine that the purpose of the #if 1 bracketing is to facilitate
the eventual deactivation of this code.

The first two cases are pretty inexpensive checks, so I suggest
we keep them as an integral part of GDB, and thus remove the #if 1
brackets.

In the last case, it's less clear-cut. The comment implies that this
may have a noticeable impact on performance. The code is a single-level
loop with a check inside:

> if (BLOCKVECTOR_NBLOCKS (blockvector) > 1)
>   {
>     for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
>       {
>         if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1))
>             > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)))
>           {
>             CORE_ADDR start
>               = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
>
>             complaint (&symfile_complaints, _("block at %s out of order"),
>                        hex_string ((LONGEST) start));
>           }
>       }
>   }

Given the fact that debugging info is usually loaded lazily, I don't
think the time taken by such a loop would be noticeable on today's
fast machines.

So I propose to also make this check an integral part of GDB by
removing the #if 1 and the associated FIXME.

Thoughts?

-- 
Joel


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