linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtraceevent: Better warning print-out
@ 2021-05-14 12:28 Yordan Karadzhov (VMware)
  2021-05-14 13:18 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-05-14 12:28 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

I see no new line when the messages are printed from KernelShark.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/trace-seq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/trace-seq.c b/src/trace-seq.c
index 8d5ecd2..6aee07a 100644
--- a/src/trace-seq.c
+++ b/src/trace-seq.c
@@ -22,7 +22,7 @@
 #define TRACE_SEQ_CHECK(s)						\
 do {									\
 	if (WARN_ONCE((s)->buffer == TRACE_SEQ_POISON,			\
-		      "Usage of trace_seq after it was destroyed"))	\
+		      "Usage of trace_seq after it was destroyed\n"))	\
 		(s)->state = TRACE_SEQ__BUFFER_POISONED;		\
 } while (0)
 
@@ -85,7 +85,7 @@ static void expand_buffer(struct trace_seq *s)
 	char *buf;
 
 	buf = realloc(s->buffer, s->buffer_size + TRACE_SEQ_BUF_SIZE);
-	if (WARN_ONCE(!buf, "Can't allocate trace_seq buffer memory")) {
+	if (WARN_ONCE(!buf, "Can't allocate trace_seq buffer memory\n")) {
 		s->state = TRACE_SEQ__MEM_ALLOC_FAILED;
 		return;
 	}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtraceevent: Better warning print-out
  2021-05-14 12:28 [PATCH] libtraceevent: Better warning print-out Yordan Karadzhov (VMware)
@ 2021-05-14 13:18 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2021-05-14 13:18 UTC (permalink / raw)
  To: Yordan Karadzhov (VMware); +Cc: linux-trace-devel

On Fri, 14 May 2021 15:28:25 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> I see no new line when the messages are printed from KernelShark.
> 
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
>  src/trace-seq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/trace-seq.c b/src/trace-seq.c
> index 8d5ecd2..6aee07a 100644
> --- a/src/trace-seq.c
> +++ b/src/trace-seq.c
> @@ -22,7 +22,7 @@
>  #define TRACE_SEQ_CHECK(s)						\
>  do {									\
>  	if (WARN_ONCE((s)->buffer == TRACE_SEQ_POISON,			\
> -		      "Usage of trace_seq after it was destroyed"))	\
> +		      "Usage of trace_seq after it was destroyed\n"))	\
>  		(s)->state = TRACE_SEQ__BUFFER_POISONED;		\
>  } while (0)
>  
> @@ -85,7 +85,7 @@ static void expand_buffer(struct trace_seq *s)
>  	char *buf;
>  
>  	buf = realloc(s->buffer, s->buffer_size + TRACE_SEQ_BUF_SIZE);
> -	if (WARN_ONCE(!buf, "Can't allocate trace_seq buffer memory")) {
> +	if (WARN_ONCE(!buf, "Can't allocate trace_seq buffer memory\n")) {
>  		s->state = TRACE_SEQ__MEM_ALLOC_FAILED;
>  		return;
>  	}

This comes from the Linux kernel which doesn't require the message to
contain a new line.

Would this patch work instead?

diff --git a/include/asm/bug.h b/include/asm/bug.h
index 550223f..de8f8fe 100644
--- a/include/asm/bug.h
+++ b/include/asm/bug.h
@@ -5,7 +5,7 @@
 #include <linux/compiler.h>
 #include <stdio.h>
 
-#define __WARN_printf(arg...)	do { fprintf(stderr, arg); } while (0)
+#define __WARN_printf(arg...)	do { fprintf(stderr, arg); fprintf(stderr, "\n");} while (0)
 
 #define WARN(condition, format...) ({		\
 	int __ret_warn_on = !!(condition);	\

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-14 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 12:28 [PATCH] libtraceevent: Better warning print-out Yordan Karadzhov (VMware)
2021-05-14 13:18 ` Steven Rostedt

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 NNTP newsgroup(s).