public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix the warning message's output
@ 2007-08-09 15:55 Lai Jiangshan
  0 siblings, 0 replies; only message in thread
From: Lai Jiangshan @ 2007-08-09 15:55 UTC (permalink / raw)
  To: systemtap

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));";

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-09  6:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-09 15:55 [patch] Fix the warning message's output Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).