On Wed, May 16, 2018 at 3:54 PM Martin Liška <mli...@suse.cz> wrote:
> On 05/16/2018 03:39 PM, Alexander Monakov wrote: > > On Wed, 16 May 2018, Martin Liška wrote: > >>> Hm, is the off-by-one in the new explanatory text really intended? I think > >>> the previous text was accurate, and the new text should say "9th and 10th" > >>> and then "first 10 invocations", unless I'm missing something? > >> > >> I've reconsidered that once more time and having zero-based values: > >> * -fdbg-cnt=event:N - trigger event N-times > >> * -fdbg-cnt=event:N:(N+M) - skip even N-times and then enable it M-1 times > >> > >> Does that make sense? > > > > Yes, I like this, but I think the implementation does not match. New docs say: > > > >> -For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, > >> -@code{dbg_cnt(dce)} returns true only for first 10 invocations. > >> +For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10}, > >> +@code{dbg_cnt(dce)} returns true only for third and fourth invocation. > >> +For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations. > > > > which is good, but the implementation reads: > > > >> bool > >> dbg_cnt_is_enabled (enum debug_counter index) > >> { > >> - return count[index] <= limit[index]; > >> + unsigned v = count[index]; > >> + return v >= limit_low[index] && v < limit_high[index]; > >> } > > > > which I believe is misaligned with the docs' intention. It should be the > > other way around: > > > > return v > limit_low[index] && v <= limit_high[index]; > Note that I changed count[index]++ to happen after dbg_cnt_is_enabled. I'm reverting that > and now it works fine with your condition. OK. Richard. > Martin > > > > Alexander > >