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 v3 10/12] btrace: Replace struct btrace_thread_info::segment.


On 2017-05-10 07:46, Wiederhake, Tim wrote:
Btw #2, I thing this function could be more efficient (or maybe I don't
understand as well as I think).  If bfun at function entry is in the
middle of a long list of segments, it will start from there and iterate
backwards until it hits the first segment.

Correct so far.

But because the same bfun
variable is reused, it will iterate forward from the start

We saved PREV and NEXT beforehand and use BFUN as a temporary variable
afterwards. The second "for" loop starts at NEXT, which is one past the
original "middle of the long list of segments".

Ah, hence the need to save next before the first loop. For some reason I thought the second loop was initialized from bfun. Sorry about that.

Simon


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