[RFA] Improve performance with lots of shared libraries

Pedro Alves pedro@codesourcery.com
Fri Jul 1 17:57:00 GMT 2011


On Friday 01 July 2011 18:45:01, Pedro Alves wrote:
> I'd rather a split in two different chunks/concepts, as per
> your description of the problem:
> 
> 1 - find_pc_partial_function is expensive, and as such we should
>     only call it when necessary.  Can we somehow only do this:
> 
> > /* Don't care about return value; stop_func_start and stop_func_name
> >     will both be 0 if it doesn't work.  */
> >  find_pc_partial_function (stop_pc, &ecs->stop_func_name,
> >                           &ecs->stop_func_start, &ecs->stop_func_end);
> >  ecs->stop_func_start
> >    += gdbarch_deprecated_function_start_offset (gdbarch);
> 
>    bit when necessary, rather than listing some special
>    cases when it is not necessary?  That is, make that bit
>    a bit more lazy.  E.g, it looks like stops for
>    BPSTAT_WHAT_STOP* never need that info.  (beware of places
>    that pass the ecs down as argument to some function that
>    ends up using those fields).

Reading back, I may have not been clear --- I'm not asking
to come up with conditions to whitelist these call under,
but rather to move that bit to a new function, like:

static void
stop_func_info (struct execution_control_state *ecs)
{
  /* Don't care about return value; stop_func_start and stop_func_name
     will both be 0 if it doesn't work.  */
     find_pc_partial_function (stop_pc, &ecs->stop_func_name,
                               &ecs->stop_func_start, &ecs->stop_func_end);
     ecs->stop_func_start
      += gdbarch_deprecated_function_start_offset (gdbarch);
}

and then call that function a bit further down, e.g.,
in the BPSTAT_WHAT_STEP_RESUME case; where it reads:

/* When stepping backward, stop at beginning of line range
   (unless it's the function entry point, in which case
	keep going back to the call point).  */

where it reads "Check for subroutine calls.", etc.

-- 
Pedro Alves



More information about the Gdb-patches mailing list