This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Support lower and upper limit for -fdbg-cnt flag.


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];

Alexander

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