[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Execution counts in gawk/master
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Execution counts in gawk/master |
Date: |
Mon, 09 Feb 2015 23:10:35 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
> Date: Mon, 09 Feb 2015 19:45:19 +0100
> From: Hermann Peifer <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [bug-gawk] Execution counts in gawk/master
>
> Hi again,
>
> I noted that the execution counts in gawk/master seem to be incomplete:
> the first count (to the left of the rule) is missing. The one that shows
> how many times the rule's pattern was tested. See below.
>
> Hermann
>
> ### gawk-4.1-stable from git ###
>
> $ ./gawk -V | head -1
> GNU Awk 4.1.1b, API: 1.1 (GNU MPFR 3.1.2-p10, GNU MP 6.0.0)
> $
> $ printf "\n\n" | ./gawk -p/dev/stdout 'NR==1'
>
> # gawk profile, created Mon Feb 9 19:28:27 2015
>
> # Rule(s)
>
> 2 NR == 1 { # 1
> 1 print $0
> }
>
> ### gawk master from git ###
>
> $ ./gawk -V | head -1
> GNU Awk 4.1.60, API: 1.1 (GNU MPFR 3.1.2-p10, GNU MP 6.0.0)
> $
> $ printf "\n\n" | ./gawk -p/dev/stdout 'NR==1'
>
> # gawk profile, created Mon Feb 9 19:34:18 2015
>
> # Rule(s)
>
> NR == 1 { # 1
> 1 print $0
> }
You're right. This is a result of the work done to get comments into
pretty-printing. This patch fixes your test case. I expect to push
it out sometime in the next 24 hours.
Thanks for the report!
Arnold
-------------------------------------------------------
diff --git a/profile.c b/profile.c
index 233bca0..2cb9e15 100644
--- a/profile.c
+++ b/profile.c
@@ -226,6 +226,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool
in_for_header)
if (do_profile && ! rule_count[rule]++)
fprintf(prof_fp, _("\t# Rule(s)\n\n"));
ip1 = pc->nexti;
+ indent(ip1->exec_count);
if (ip1 != (pc + 1)->firsti) { /*
non-empty pattern */
pprint(ip1->nexti, (pc + 1)->firsti,
false);
/* Allow for case where the "pattern"
is just a comment */