From cf509e712520c6e18ecdf290b5ef85811e8ef013 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 4 Sep 2009 16:41:55 -0400 Subject: [PATCH] runtime diagnostics: remove ANSI goo, add -DSTAP_DEBUG_PRINTK option. * runtime/io.c (_stp_vlog): Don't put ansi highlighting into debugging messages. #if STAP_DEBUG_PRINTK, direct all diagnostics to appropriate printk channel instead of runtime trace buffer. --- runtime/io.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runtime/io.c b/runtime/io.c index 687926fd8..0136aae56 100644 --- a/runtime/io.c +++ b/runtime/io.c @@ -32,7 +32,7 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f int start = 0; if (type == DBUG) { - start = _stp_snprintf(buf, STP_LOG_BUF_LEN, "\033[36m%s:%d:\033[0m ", func, line); + start = _stp_snprintf(buf, STP_LOG_BUF_LEN, "%s:%d: ", func, line); } else if (type == WARN) { strcpy (buf, WARN_STRING); start = sizeof(WARN_STRING) - 1; @@ -49,12 +49,19 @@ static void _stp_vlog (enum code type, const char *func, int line, const char *f buf[num + start] = '\0'; } +#ifdef STAP_DEBUG_PRINTK + if (type == DBUG) printk (KERN_DEBUG "%s", buf); + else if (type == WARN) printk (KERN_WARNING "%s", buf); + else if (type == ERROR) printk (KERN_ERR "%s", buf); + else printk (KERN_INFO "%s", buf); +#else if (type != DBUG) _stp_ctl_write(STP_OOB_DATA, buf, start + num + 1); else { _stp_print(buf); _stp_print_flush(); } +#endif } put_cpu(); } -- 2.43.5