This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[patch] Fix the warning message's output
- From: Lai Jiangshan <laijs at cn dot fujitsu dot com>
- To: systemtap at sourceware dot org
- Date: Thu, 09 Aug 2007 15:34:05 +0900
- Subject: [patch] Fix the warning message's output
hi! everyone
when i was using systemtap to strace syscall open, i found that a warning message was
outputted to the stdout(or to the file specified by -o option).
$ /home/lai/usr/bin/stap -V
SystemTap translator/driver (version 0.5.15/0.128 built 2007-08-09)
Copyright (C) 2005-2007 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
$ cat open.stp
probe syscall.open {
printf("%s\n", filename)
}
$ /home/lai/usr/bin/stap open.stp -c echo -o stap.out
$ cat stap.out
/etc/ld.so.cache
/lib/libtermcap.so.2
......
WARNING: Number of errors: 0, skipped probes: 1
These messages should be outputted to stderr but not stdout. Just as all the other warning messages.
This kind of bug exists in both os_timer.c and translate.cxx.
They can be fixed by the following patch:
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
diff -Nur systemtap-20070804-old/runtime/probes/os_timer/os_timer.c systemtap-20070804/runtime/probes/os_timer/os_timer.c
--- systemtap-20070804-old/runtime/probes/os_timer/os_timer.c 2005-11-09 10:00:40.000000000 +0900
+++ systemtap-20070804/runtime/probes/os_timer/os_timer.c 2007-08-09 14:43:31.000000000 +0900
@@ -113,7 +113,7 @@
/* print out any colledted data, etc */
_stp_printf ("os timer done.\n");
- _stp_printf ("WARNING: Currently using task_pt_regs() to get the pt_regs struct\n");
+ _stp_warn ("Currently using task_pt_regs() to get the pt_regs struct\n");
_stp_printf ("during the timer interrupt, but there seems to be issues with that...\n\n");
_stp_stat_print (timing, "timing (cpu cycles): # calls:%C avg:%A min:%m max:%M\n%H", 0);
diff -Nur systemtap-20070804-old/translate.cxx systemtap-20070804/translate.cxx
--- systemtap-20070804-old/translate.cxx 2007-06-15 06:38:24.000000000 +0900
+++ systemtap-20070804/translate.cxx 2007-08-09 13:30:57.000000000 +0900
@@ -1306,7 +1306,7 @@
// print final error/reentrancy counts if non-zero
o->newline() << "if (atomic_read (& skipped_count) || "
<< "atomic_read (& error_count)) {";
- o->newline(1) << "_stp_printf (\"WARNING: Number of errors: %d, "
+ o->newline(1) << "_stp_warn (\"Number of errors: %d, "
<< "skipped probes: %d\\n\", "
<< "(int) atomic_read (& error_count), "
<< "(int) atomic_read (& skipped_count));";