Re: [RFA 1/2] Make line tables independent of progspace

Simon Marchi
2018-03-28T12:32:36Z

On 2018-03-28 01:02 AM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
>>> + auto pc_compare = [=](const CORE_ADDR & pc,
>>> + const struct linetable_entry & lhs)->bool
>>> {
>>> - return pc < lhs.pc;
>>> + return pc < lhs.address (iter_s);
>>> };
>
> Simon> Since we know this will be called many times and address() is substantially
> Simon> more costly than just reading a CORE_ADDR field, maybe it would be good to
> Simon> save it to a variable before and use that in the lambda.
>
> I am not sure this would work, because LHS is what changes here --
> std::upper_bound is searching through the line table looking for a
> match.
>
> One idea might be to "unrelocate" PC to do the search. This would make
> the search more efficient. I will try this.

Ah sorry, you are right.

Simon