Skip to contentSkip to conversation

x86/tools: Rename tools and cleanup messages for insn decoder

PATCH New Masami Hiramatsu 2 participants 7 messages Nov 24, 2017 – Dec 12, 2017 x86

lore
Share & tools
lore
#0 lore raw

cover x86/tools: Rename tools and cleanup messages for insn decoder

These patches renames tools and cleanup messages for x86 insn decoder according to Ingo's comment. It is a kind of cleanup series of code. Just changes meaningless command names to appropriate (or better) one and does some cleanup including standarize messages.

---

Masami Hiramatsu (3):
x86: tools: Rename test_get_len to insn_decoder_test
x86: tools: Rename distill.awk to objdump_reformat.awk
x86: tools: Standardize output format of insn_decode_test

 arch/x86/tools/Makefile             |   12 +-
 arch/x86/tools/distill.awk          |   48 ---------
 arch/x86/tools/insn_decoder_test.c  |  180 +++++++++++++++++++++++++++++++++++
 arch/x86/tools/objdump_reformat.awk |   48 +++++++++
 arch/x86/tools/test_get_len.c       |  173 ----------------------------------
 5 files changed, 234 insertions(+), 227 deletions(-)
 delete mode 100644 arch/x86/tools/distill.awk
 create mode 100644 arch/x86/tools/insn_decoder_test.c
 create mode 100644 arch/x86/tools/objdump_reformat.awk
 delete mode 100644 arch/x86/tools/test_get_len.c

--
Masami Hiramatsu <[email protected]>

#1 lore raw

PATCH 1/3 x86: tools: Rename test_get_len to insn_decoder_test

Rename test_get_len test command to insn_decoder_test as more meaningful name. This also changes some comments in related files.

Note that this also removes the paragraph about
writing to the Free Software Foundation's mailing
address.

---
 arch/x86/tools/Makefile            |   10 +-
 arch/x86/tools/distill.awk         |    2 
 arch/x86/tools/insn_decoder_test.c |  169 +++++++++++++++++++++++++++++++++++
 arch/x86/tools/test_get_len.c      |  173 ------------------------------------
 4 files changed, 175 insertions(+), 179 deletions(-)
 create mode 100644 arch/x86/tools/insn_decoder_test.c
 delete mode 100644 arch/x86/tools/test_get_len.c
arch/x86/tools/Makefile +5 -5
index 972b8e8d939c..b0d75684d313 100644
@@ -17,24 +17,24 @@ distill_awk = $(srctree)/arch/x86/tools/distill.awk
 chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk
 
 quiet_cmd_posttest = TEST    $@
-      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/test_get_len $(posttest_64bit) $(posttest_verbose)
+      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
 
 quiet_cmd_sanitytest = TEST    $@
       cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000
 
-posttest: $(obj)/test_get_len vmlinux $(obj)/insn_sanity
+posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity
 	$(call cmd,posttest)
 	$(call cmd,sanitytest)
 
-hostprogs-y	+= test_get_len insn_sanity
+hostprogs-y	+= insn_decoder_test insn_sanity
 
 # -I needed for generated C source and C source which in the kernel tree.
-HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
+HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
 
 HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/
 
 # Dependencies are also needed.
-$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
+$(obj)/insn_decoder_test.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
 
 $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
 
arch/x86/tools/distill.awk +1 -1
index e0edeccc1429..80cd7d53bd07 100644
@@ -1,6 +1,6 @@
 #!/bin/awk -f
 # SPDX-License-Identifier: GPL-2.0
-# Usage: objdump -d a.out | awk -f distill.awk | ./test_get_len
+# Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
 # Distills the disassembly as follows:
 # - Removes all lines except the disassembled instructions.
 # - For instructions that exceed 1 line (7 bytes), crams all the hex bytes
arch/x86/tools/insn_decoder_test.c new file +169 -0

169 lines not on this page · raw message

arch/x86/tools/test_get_len.c deleted +0 -173

173 lines not on this page · raw message

#2 lore raw

[tip:perf/core] x86/tools: Rename test_get_len to insn_decoder_test

x86/tools: Rename test_get_len to insn_decoder_test
Commit-ID:  6b63dd119eb4eee44733ca435168ce05487b8644
Gitweb:     https://git.kernel.org/tip/6b63dd119eb4eee44733ca435168ce05487b8644
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Sat, 25 Nov 2017 00:10:25 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 12 Dec 2017 13:27:47 +0100

x86/tools: Rename test_get_len to insn_decoder_test

Rename test_get_len test command to insn_decoder_test as it a more meaningful name. This also changes some comments in related files.

Note that this also removes the paragraph about writing to the Free Software Foundation's mailing address.

---
 arch/x86/tools/Makefile                                | 10 +++++-----
 arch/x86/tools/distill.awk                             |  2 +-
 arch/x86/tools/{test_get_len.c => insn_decoder_test.c} |  6 +-----
 3 files changed, 7 insertions(+), 11 deletions(-)
arch/x86/tools/Makefile +5 -5
index 972b8e8..b0d7568 100644
@@ -17,24 +17,24 @@ distill_awk = $(srctree)/arch/x86/tools/distill.awk
 chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk
 
 quiet_cmd_posttest = TEST    $@
-      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/test_get_len $(posttest_64bit) $(posttest_verbose)
+      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
 
 quiet_cmd_sanitytest = TEST    $@
       cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000
 
-posttest: $(obj)/test_get_len vmlinux $(obj)/insn_sanity
+posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity
 	$(call cmd,posttest)
 	$(call cmd,sanitytest)
 
-hostprogs-y	+= test_get_len insn_sanity
+hostprogs-y	+= insn_decoder_test insn_sanity
 
 # -I needed for generated C source and C source which in the kernel tree.
-HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
+HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
 
 HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/
 
 # Dependencies are also needed.
-$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
+$(obj)/insn_decoder_test.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
 
 $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
 
arch/x86/tools/distill.awk +1 -1
index e0edecc..80cd7d5 100644
@@ -1,6 +1,6 @@
 #!/bin/awk -f
 # SPDX-License-Identifier: GPL-2.0
-# Usage: objdump -d a.out | awk -f distill.awk | ./test_get_len
+# Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
 # Distills the disassembly as follows:
 # - Removes all lines except the disassembled instructions.
 # - For instructions that exceed 1 line (7 bytes), crams all the hex bytes
arch/x86/tools/insn_decoder_test.c renamed from arch/x86/tools/test_get_len.c +1 -5
similarity index 94%
rename from arch/x86/tools/test_get_len.c
rename to arch/x86/tools/insn_decoder_test.c
index ecf31e0..8be7264 100644
@@ -9,10 +9,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
  * Copyright (C) IBM Corporation, 2009
  */
 
@@ -33,7 +29,7 @@
  * particular.  See if insn_get_length() and the disassembler agree
  * on the length of each instruction in an elf disassembly.
  *
- * Usage: objdump -d a.out | awk -f distill.awk | ./test_get_len
+ * Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
  */
 
 const char *prog;
#3 lore raw

PATCH 2/3 x86: tools: Rename distill.awk to objdump_reformat.awk

In reply to Masami Hiramatsu

Rename distill.awk to objdump_reformat.awk because it actually re-format the output of objdump so that insn_decoder_test can read it.

---
 arch/x86/tools/Makefile             |    4 +--
 arch/x86/tools/distill.awk          |   48 -----------------------------------
 arch/x86/tools/insn_decoder_test.c  |    6 ++--
 arch/x86/tools/objdump_reformat.awk |   48 +++++++++++++++++++++++++++++++++++
 4 files changed, 53 insertions(+), 53 deletions(-)
 delete mode 100644 arch/x86/tools/distill.awk
 create mode 100644 arch/x86/tools/objdump_reformat.awk
arch/x86/tools/Makefile +2 -2
index b0d75684d313..09af7ff53044 100644
@@ -13,11 +13,11 @@ else
   posttest_64bit = -n
 endif
 
-distill_awk = $(srctree)/arch/x86/tools/distill.awk
+reformatter = $(srctree)/arch/x86/tools/objdump_reformat.awk
 chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk
 
 quiet_cmd_posttest = TEST    $@
-      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
+      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(reformatter) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
 
 quiet_cmd_sanitytest = TEST    $@
       cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000
arch/x86/tools/distill.awk deleted +0 -48

48 lines not on this page · raw message

arch/x86/tools/insn_decoder_test.c +3 -3
index 8be7264cb723..286d2e3b9d57 100644
@@ -29,7 +29,7 @@
  * particular.  See if insn_get_length() and the disassembler agree
  * on the length of each instruction in an elf disassembly.
  *
- * Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
+ * Usage: objdump -d a.out | awk -f objdump_reformat.awk | ./insn_decoder_test
  */
 
 const char *prog;
@@ -38,8 +38,8 @@ static int x86_64;
 
 static void usage(void)
 {
-	fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
-		" %s [-y|-n] [-v]\n", prog);
+	fprintf(stderr, "Usage: objdump -d a.out | awk -f objdump_reformat.awk"
+		" | %s [-y|-n] [-v]\n", prog);
 	fprintf(stderr, "\t-y	64bit mode\n");
 	fprintf(stderr, "\t-n	32bit mode\n");
 	fprintf(stderr, "\t-v	verbose mode\n");
arch/x86/tools/objdump_reformat.awk new file +48 -0

48 lines not on this page · raw message

#4 lore raw

[tip:perf/core] x86/tools: Rename distill.awk to objdump_reformat.awk

x86/tools: Rename distill.awk to objdump_reformat.awk
Commit-ID:  98fe07fccc3e25889186277a5158c0a658d528a4
Gitweb:     https://git.kernel.org/tip/98fe07fccc3e25889186277a5158c0a658d528a4
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Sat, 25 Nov 2017 00:10:54 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 12 Dec 2017 13:27:47 +0100

x86/tools: Rename distill.awk to objdump_reformat.awk

Rename distill.awk to objdump_reformat.awk because it more clearly expresses its purpose of re-formatting the output of objdump so that insn_decoder_test can read it.

---
 arch/x86/tools/Makefile                              | 4 ++--
 arch/x86/tools/insn_decoder_test.c                   | 6 +++---
 arch/x86/tools/{distill.awk => objdump_reformat.awk} | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
arch/x86/tools/Makefile +2 -2
index b0d7568..09af7ff 100644
@@ -13,11 +13,11 @@ else
   posttest_64bit = -n
 endif
 
-distill_awk = $(srctree)/arch/x86/tools/distill.awk
+reformatter = $(srctree)/arch/x86/tools/objdump_reformat.awk
 chkobjdump = $(srctree)/arch/x86/tools/chkobjdump.awk
 
 quiet_cmd_posttest = TEST    $@
-      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(distill_awk) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
+      cmd_posttest = ($(OBJDUMP) -v | $(AWK) -f $(chkobjdump)) || $(OBJDUMP) -d -j .text $(objtree)/vmlinux | $(AWK) -f $(reformatter) | $(obj)/insn_decoder_test $(posttest_64bit) $(posttest_verbose)
 
 quiet_cmd_sanitytest = TEST    $@
       cmd_sanitytest = $(obj)/insn_sanity $(posttest_64bit) -m 1000000
arch/x86/tools/insn_decoder_test.c +3 -3
index 8be7264..286d2e3 100644
@@ -29,7 +29,7 @@
  * particular.  See if insn_get_length() and the disassembler agree
  * on the length of each instruction in an elf disassembly.
  *
- * Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
+ * Usage: objdump -d a.out | awk -f objdump_reformat.awk | ./insn_decoder_test
  */
 
 const char *prog;
@@ -38,8 +38,8 @@ static int x86_64;
 
 static void usage(void)
 {
-	fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
-		" %s [-y|-n] [-v]\n", prog);
+	fprintf(stderr, "Usage: objdump -d a.out | awk -f objdump_reformat.awk"
+		" | %s [-y|-n] [-v]\n", prog);
 	fprintf(stderr, "\t-y	64bit mode\n");
 	fprintf(stderr, "\t-n	32bit mode\n");
 	fprintf(stderr, "\t-v	verbose mode\n");
arch/x86/tools/objdump_reformat.awk renamed from arch/x86/tools/distill.awk +2 -2
similarity index 91%
rename from arch/x86/tools/distill.awk
rename to arch/x86/tools/objdump_reformat.awk
index 80cd7d5..f418c91 100644
@@ -1,7 +1,7 @@
 #!/bin/awk -f
 # SPDX-License-Identifier: GPL-2.0
-# Usage: objdump -d a.out | awk -f distill.awk | ./insn_decoder_test
-# Distills the disassembly as follows:
+# Usage: objdump -d a.out | awk -f objdump_reformat.awk | ./insn_decoder_test
+# Reformats the disassembly as follows:
 # - Removes all lines except the disassembled instructions.
 # - For instructions that exceed 1 line (7 bytes), crams all the hex bytes
 # into a single line.
#5 lore raw

PATCH 3/3 x86: tools: Standardize output format of insn_decode_test

In reply to Masami Hiramatsu

Standardize warning, error, and success printout format of insn_decode_test so that user can easily understand which test tool caused the messages.

---
 arch/x86/tools/insn_decoder_test.c |   33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)
arch/x86/tools/insn_decoder_test.c +22 -11
index 286d2e3b9d57..a3b4fd954931 100644
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <assert.h>
 #include <unistd.h>
+#include <stdarg.h>
 
 #define unlikely(cond) (cond)
 
@@ -48,10 +49,21 @@ static void usage(void)
 
 static void malformed_line(const char *line, int line_nr)
 {
-	fprintf(stderr, "%s: malformed line %d:\n%s", prog, line_nr, line);
+	fprintf(stderr, "%s: error: malformed line %d:\n%s",
+		prog, line_nr, line);
 	exit(3);
 }
 
+static void pr_warn(const char *fmt, ...)
+{
+	va_list ap;
+
+	fprintf(stderr, "%s: warning: ", prog);
+	va_start(ap, fmt);
+	vfprintf(stderr, fmt, ap);
+	va_end(ap);
+}
+
 static void dump_field(FILE *fp, const char *name, const char *indent,
 		       struct insn_field *field)
 {
@@ -149,21 +161,20 @@ int main(int argc, char **argv)
 		insn_get_length(&insn);
 		if (insn.length != nb) {
 			warnings++;
-			fprintf(stderr, "Warning: %s found difference at %s\n",
-				prog, sym);
-			fprintf(stderr, "Warning: %s", line);
-			fprintf(stderr, "Warning: objdump says %d bytes, but "
-				"insn_get_length() says %d\n", nb,
-				insn.length);
+			pr_warn("Found an x86 instruction decoder bug, "
+				"please report this.\n", sym);
+			pr_warn("%s", line);
+			pr_warn("objdump says %d bytes, but insn_get_length() "
+				"says %d\n", nb, insn.length);
 			if (verbose)
 				dump_insn(stderr, &insn);
 		}
 	}
 	if (warnings)
-		fprintf(stderr, "Warning: decoded and checked %d"
-			" instructions with %d warnings\n", insns, warnings);
+		pr_warn("Decoded and checked %d instructions with %d "
+			"failures\n", insns, warnings);
 	else
-		fprintf(stdout, "Success: decoded and checked %d"
-			" instructions\n", insns);
+		fprintf(stdout, "%s: success: Decoded and checked %d"
+			" instructions\n", prog, insns);
 	return 0;
 }
#6 lore raw

[tip:perf/core] x86/tools: Standardize output format of insn_decode_test

x86/tools: Standardize output format of insn_decode_test
Commit-ID:  10c91577d5e631773a6394e14cf60125389b71ae
Gitweb:     https://git.kernel.org/tip/10c91577d5e631773a6394e14cf60125389b71ae
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Sat, 25 Nov 2017 00:11:22 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 12 Dec 2017 13:27:47 +0100

x86/tools: Standardize output format of insn_decode_test

Standardize warning, error, and success printout format of insn_decode_test so that user can easily understand which test tool caused the messages.

---
 arch/x86/tools/insn_decoder_test.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)
arch/x86/tools/insn_decoder_test.c +22 -11
index 286d2e3..a3b4fd9 100644
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <assert.h>
 #include <unistd.h>
+#include <stdarg.h>
 
 #define unlikely(cond) (cond)
 
@@ -48,10 +49,21 @@ static void usage(void)
 
 static void malformed_line(const char *line, int line_nr)
 {
-	fprintf(stderr, "%s: malformed line %d:\n%s", prog, line_nr, line);
+	fprintf(stderr, "%s: error: malformed line %d:\n%s",
+		prog, line_nr, line);
 	exit(3);
 }
 
+static void pr_warn(const char *fmt, ...)
+{
+	va_list ap;
+
+	fprintf(stderr, "%s: warning: ", prog);
+	va_start(ap, fmt);
+	vfprintf(stderr, fmt, ap);
+	va_end(ap);
+}
+
 static void dump_field(FILE *fp, const char *name, const char *indent,
 		       struct insn_field *field)
 {
@@ -149,21 +161,20 @@ int main(int argc, char **argv)
 		insn_get_length(&insn);
 		if (insn.length != nb) {
 			warnings++;
-			fprintf(stderr, "Warning: %s found difference at %s\n",
-				prog, sym);
-			fprintf(stderr, "Warning: %s", line);
-			fprintf(stderr, "Warning: objdump says %d bytes, but "
-				"insn_get_length() says %d\n", nb,
-				insn.length);
+			pr_warn("Found an x86 instruction decoder bug, "
+				"please report this.\n", sym);
+			pr_warn("%s", line);
+			pr_warn("objdump says %d bytes, but insn_get_length() "
+				"says %d\n", nb, insn.length);
 			if (verbose)
 				dump_insn(stderr, &insn);
 		}
 	}
 	if (warnings)
-		fprintf(stderr, "Warning: decoded and checked %d"
-			" instructions with %d warnings\n", insns, warnings);
+		pr_warn("Decoded and checked %d instructions with %d "
+			"failures\n", insns, warnings);
 	else
-		fprintf(stdout, "Success: decoded and checked %d"
-			" instructions\n", insns);
+		fprintf(stdout, "%s: success: Decoded and checked %d"
+			" instructions\n", prog, insns);
 	return 0;
 }