Skip to contentSkip to conversation

Introduce vtracef

PATCH Superseded Maxime Roussin-Belanger 2 participants 7 messages Feb 24, 2020 – Mar 3, 2020

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 Introduce vtracef

vtracef accepts a va_list argument to simplify
tracing functions which use a va_list

Here's an example from wpa_supplicant that I wanted to trace:

void wpa_debug(int level, const char* fmt, ...)

{
	va_list ap;
	va_start(ap, fmt);

	...
	// The call I want to easily trace with vtracef
	vprintf(fmt, ap);

	...
	va_end(ap);
}

wpa_debug is used a fair amount and it would be annoying to replace all the wpa_debug calls with tracef.

With vtracef, it simplifies the find and replace effort by only changing it at one place.

---
Changes in v3:
* Fix coding style patch

 doc/examples/demo-tracef/Makefile       | 14 +++++-
 doc/examples/demo-tracef/demo-vtracef.c | 59 +++++++++++++++++++++++++
 doc/man/tracef-tracelog-limitations.txt |  3 ++
 doc/man/tracef.3.txt                    | 11 ++---
 include/lttng/tracef.h                  |  8 ++++
 liblttng-ust/tracef.c                   | 18 +++++---
 6 files changed, 100 insertions(+), 13 deletions(-)
 create mode 100644 doc/examples/demo-tracef/demo-vtracef.c
doc/examples/demo-tracef/Makefile +12 -2
index ee207843..809aac19 100644
@@ -20,18 +20,28 @@ LIBS = -ldl -llttng-ust	# On Linux
 LOCAL_CPPFLAGS += -I.
 AM_V_P := :
 
-all: demo-tracef
+all: demo-tracef demo-vtracef
 
 demo-tracef.o: demo-tracef.c
 	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
 		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 demo-tracef: demo-tracef.o
 	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
 		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ $< $(LIBS)
 
+demo-vtracef.o: demo-vtracef.c
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+		$(CFLAGS) -c -o $@ $<
+
+demo-vtracef: demo-vtracef.o
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+		-o $@ $< $(LIBS)
+
 .PHONY: clean
 clean:
-	rm -f *.o *.a demo-tracef
+	rm -f *.o *.a demo-tracef demo-vtracef
doc/examples/demo-tracef/demo-vtracef.c new file +59 -0

59 lines not on this page · raw message

doc/man/tracef-tracelog-limitations.txt +3 -0
index a9491903..ad4130dd 100644
@@ -21,4 +21,7 @@ Thus, +{macro-name}()+ is useful for quick prototyping and debugging, but
 should not be considered for any permanent/serious application
 instrumentation.
 
++v{macro-name}()+ does not have a `STAP_PROBEV()` call, because `STAP_PROBEV()`
+does not support `va_list`. If you need it, you should emit this call yourself.
+
 See man:lttng-ust(3) to learn more about custom tracepoint providers.
doc/man/tracef.3.txt +6 -5
index 1068afad..2894ca45 100644
@@ -5,43 +5,44 @@ tracef(3)
 
 NAME
 ----
-tracef - LTTng-UST printf(3)-like interface
+tracef, vtracef - LTTng-UST printf(3)-like interface
 
 
 SYNOPSIS
 --------
 [verse]
 *#include <lttng/tracef.h>*
 
 [verse]
 #define *tracef*('fmt', ...)
+#define *vtracef*('fmt', 'va_list' ap)
 
 Link with `-llttng-ust`.
 
 
 DESCRIPTION
 -----------
 The LTTng-UST `tracef()` API allows you to trace your application with
 the help of a simple man:printf(3)-like macro. The 'fmt' argument is
 passed directly to the 'fmt' parameter of man:vasprintf(3), as well as
 the optional parameters following 'fmt'.
 
-To use `tracef()`, include `<lttng/tracef.h>` where you need it, and
-link your application with `liblttng-ust`. See the <<example,EXAMPLE>>
+To use `tracef()` or `vtracef()`, include `<lttng/tracef.h>` where you need it,
+and link your application with `liblttng-ust`. See the <<example,EXAMPLE>>
 section below for a complete usage example.
 
-Once your application is instrumented with `tracef()` calls and
+Once your application is instrumented with `tracef()` or `vtracef()` calls and
 ready to run, use man:lttng-enable-event(1) to enable the
 `lttng_ust_tracef:*` event.
 
 The `tracef()` events contain a single field, named `msg`, which is the
 formatted string output.
 
 If you need to attach a specific log level to a `tracef()` call, use
 man:tracelog(3) instead.
 
 See also the <<limitations,LIMITATIONS>> section below for important
-limitations to consider when using `tracef()`.
+limitations to consider when using `tracef()` or `vtracef()`.
 
 
 [[example]]
include/lttng/tracef.h +8 -0
index 0c59c9ae..854ccdce 100644
@@ -32,13 +32,21 @@ extern "C" {
 extern
 void _lttng_ust_tracef(const char *fmt, ...);
 
+extern
+void _lttng_ust_vtracef(const char *fmt, va_list ap);
+
 #define tracef(fmt, ...)						\
 	do {								\
 		LTTNG_STAP_PROBEV(tracepoint_lttng_ust_tracef, event, ## __VA_ARGS__); \
 		if (caa_unlikely(__tracepoint_lttng_ust_tracef___event.state)) \
 			_lttng_ust_tracef(fmt, ## __VA_ARGS__);		\
 	} while (0)
 
+#define vtracef(fmt, ap)						\
+	do {								\
+		if (caa_unlikely(__tracepoint_lttng_ust_tracef___event.state)) \
+			_lttng_ust_vtracef(fmt, ap);		\
+	} while (0)
 #ifdef __cplusplus
 }
 #endif
liblttng-ust/tracef.c +12 -6
index ea98e43e..1311f0d5 100644
@@ -29,20 +29,26 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracef-provider.h"
 
-void _lttng_ust_tracef(const char *fmt, ...)
+void _lttng_ust_vtracef(const char *fmt, va_list ap)
 {
-	va_list ap;
 	char *msg;
-	int len;
-
-	va_start(ap, fmt);
-	len = vasprintf(&msg, fmt, ap);
+	const int len = vasprintf(&msg, fmt, ap);
 	/* len does not include the final \0 */
 	if (len < 0)
 		goto end;
 	__tracepoint_cb_lttng_ust_tracef___event(msg, len,
 		LTTNG_UST_CALLER_IP());
 	free(msg);
 end:
+	return;
+}
+
+void _lttng_ust_tracef(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	_lttng_ust_vtracef(fmt, ap);
+
 	va_end(ap);
 }
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 2/2 Introduce vtracelog

vtracelog works the same as vtracef, but takes a log level as a parameter and has the same limitations.

---
Changes in v3:
* Add this patch

doc/examples/demo-tracelog/Makefile | 14 +++++-

 doc/examples/demo-tracelog/demo-vtracelog.c | 53 +++++++++++++++++++++
 doc/man/tracelog.3.txt                      |  9 ++--
 include/lttng/tracelog.h                    |  7 +++
 liblttng-ust/tracelog.c                     | 24 ++++++----
 5 files changed, 93 insertions(+), 14 deletions(-)
 create mode 100644 doc/examples/demo-tracelog/demo-vtracelog.c
doc/examples/demo-tracelog/Makefile +12 -2
index 0d9a20aa..623979d3 100644
@@ -20,18 +20,28 @@ LIBS = -ldl -llttng-ust	# On Linux
 LOCAL_CPPFLAGS += -I.
 AM_V_P := :
 
-all: demo-tracelog
+all: demo-tracelog demo-vtracelog
 
 demo-tracelog.o: demo-tracelog.c
 	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
 		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
 		$(CFLAGS) -c -o $@ $<
 
 demo-tracelog: demo-tracelog.o
 	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
 		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
 		-o $@ $< $(LIBS)
 
+demo-vtracelog.o: demo-vtracelog.c
+	@if $(AM_V_P); then set -x; else echo "  CC       $@"; fi; \
+		$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
+		$(CFLAGS) -c -o $@ $<
+
+demo-vtracelog: demo-vtracelog.o
+	@if $(AM_V_P); then set -x; else echo "  CCLD     $@"; fi; \
+		$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
+		-o $@ $< $(LIBS)
+
 .PHONY: clean
 clean:
-	rm -f *.o *.a demo-tracelog
+	rm -f *.o *.a demo-tracelog demo-vtracelog
doc/examples/demo-tracelog/demo-vtracelog.c new file +53 -0

53 lines not on this page · raw message

doc/man/tracelog.3.txt +5 -4
index 1281ce7c..5cf1953a 100644
@@ -15,6 +15,7 @@ SYNOPSIS
 
 [verse]
 #define *tracelog*('level', 'fmt', ...)
+#define *vtracelog*('level', 'fmt', 'va_list' ap)
 
 Link with `-llttng-ust`.
 
@@ -34,9 +35,9 @@ The available values for the 'level' parameter are:
 
 include::log-levels.txt[]
 
-To use `tracelog()`, include `<lttng/tracelog.h>` where you need it, and
-link your application with `liblttng-ust`. See the <<example,EXAMPLE>>
-section below for a complete usage example.
+To use `tracelog()` or `vtracelog()`, include `<lttng/tracelog.h>` where you
+need it, and link your application with `liblttng-ust`.
+See the <<example,EXAMPLE>> section below for a complete usage example.
 
 Once your application is instrumented with `tracelog()` calls and
 ready to run, use man:lttng-enable-event(1) to enable the
@@ -67,7 +68,7 @@ If you do not need to attach a specific log level to a `tracelog()`
 call, use man:tracef(3) instead.
 
 See also the <<limitations,LIMITATIONS>> section below for important
-limitations to consider when using `tracelog()`.
+limitations to consider when using `tracelog()` or `vtracelog()`.
 
 
 [[example]]
include/lttng/tracelog.h +7 -0
index 4309d12e..7aa86809 100644
@@ -59,6 +59,13 @@ TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG);
 				fmt, ## __VA_ARGS__); \
 	} while (0)
 
+#define vtracelog(level, fmt, ap)					\
+	do {								\
+		if (caa_unlikely(__tracepoint_lttng_ust_tracelog___##level.state)) \
+			_lttng_ust_tracelog_##level(__FILE__, __LINE__, __func__, \
+				fmt, ap); \
+	} while (0)
+
 #ifdef __cplusplus
 }
 #endif
liblttng-ust/tracelog.c +16 -8
index 65fc87ed..17546605 100644
@@ -29,27 +29,35 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracelog-provider.h"
 
+
 #define TRACELOG_CB(level) \
-	void _lttng_ust_tracelog_##level(const char *file, \
+	void _lttng_ust_vtracelog_##level(const char *file, \
 			int line, const char *func, \
-			const char *fmt, ...) \
+			const char *fmt, va_list ap) \
 	{ \
-		va_list ap; \
-		char *msg; \
-		int len; \
+ 		char *msg; \
+		const int len = vasprintf(&msg, fmt, ap); \
 		\
-		va_start(ap, fmt); \
-		len = vasprintf(&msg, fmt, ap); \
 		/* len does not include the final \0 */ \
 		if (len < 0) \
 			goto end; \
 		__tracepoint_cb_lttng_ust_tracelog___##level(file, \
 			line, func, msg, len, \
 			LTTNG_UST_CALLER_IP()); \
 		free(msg); \
 	end: \
+		return; \
+	} \
+	\
+	void _lttng_ust_tracelog_##level(const char *file, \
+			int line, const char *func, \
+			const char *fmt, ...) \
+	{ \
+		va_list ap; \
+		va_start(ap, fmt); \
+		_lttng_ust_vtracelog_##level(file, line, func, fmt, ap); \
 		va_end(ap); \
-	}
+	} \
 
 TRACELOG_CB(TRACE_EMERG)
 TRACELOG_CB(TRACE_ALERT)
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v3 lttng-ust 2/2] Introduce vtracelog

----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger [email protected] wrote:
[...]

doc/examples/demo-tracelog/demo-vtracelog.c line 40

Quoted 6 lines
doc/examples/demo-tracelog/demo-vtracelog.c new file +6 -0
+int main(int argc, char **argv)
+{
+	int i;
+	int delay = 0;
+
+	if (argc == 2)

Check for argc > 2 as well here.

[...]

Quoted 20 lines
liblttng-ust/tracelog.c +4 -5
index 65fc87ed..17546605 100644
@@ -29,27 +29,35 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracelog-provider.h"
 
+
 #define TRACELOG_CB(level) \
-	void _lttng_ust_tracelog_##level(const char *file, \
+	void _lttng_ust_vtracelog_##level(const char *file, \
 			int line, const char *func, \
-			const char *fmt, ...) \
+			const char *fmt, va_list ap) \
 	{ \
-		va_list ap; \
-		char *msg; \
-		int len; \
+ 		char *msg; \

liblttng-ust/tracelog.c line 46

Quoted 10 lines
liblttng-ust/tracelog.c +1 -2
+		const int len = vasprintf(&msg, fmt, ap); \
 		\
-		va_start(ap, fmt); \
-		len = vasprintf(&msg, fmt, ap); \
 		/* len does not include the final \0 */ \
 		if (len < 0) \
 			goto end; \
 		__tracepoint_cb_lttng_ust_tracelog___##level(file, \
 			line, func, msg, len, \
 			LTTNG_UST_CALLER_IP()); \

Same as tracef: LTTNG_UST_CALLER_IP() does not have the expected behavior for _lttng_ust_tracelog_##level anymore. And I would want to ensure we don't add an additional call indirection in the generated text.

Quoted 5 lines
liblttng-ust/tracelog.c +3 -0
 		free(msg); \
 	end: \
+		return; \
+	} \
+	\

liblttng-ust/tracelog.c line 60

Quoted 10 lines
liblttng-ust/tracelog.c +8 -1
+	void _lttng_ust_tracelog_##level(const char *file, \
+			int line, const char *func, \
+			const char *fmt, ...) \
+	{ \
+		va_list ap; \
+		va_start(ap, fmt); \
+		_lttng_ust_vtracelog_##level(file, line, func, fmt, ap); \
 		va_end(ap); \
-	}
+	} \

I suspect you will want to remove the "\" on the last line here.

Thanks,

Mathieu

Quoted 10 lines
liblttng-ust/tracelog.c +0 -1
 TRACELOG_CB(TRACE_EMERG)
 TRACELOG_CB(TRACE_ALERT)
--

2.20.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#3 lore raw
In reply to Maxime Roussin-Belanger

----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger [email protected] wrote:

[...]

Quoted 35 lines
liblttng-ust/tracef.c +2 -6
index ea98e43e..1311f0d5 100644
@@ -29,20 +29,26 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracef-provider.h"
 
-void _lttng_ust_tracef(const char *fmt, ...)
+void _lttng_ust_vtracef(const char *fmt, va_list ap)
 {
-	va_list ap;
 	char *msg;
-	int len;
-
-	va_start(ap, fmt);
-	len = vasprintf(&msg, fmt, ap);
+	const int len = vasprintf(&msg, fmt, ap);
 	/* len does not include the final \0 */
 	if (len < 0)
 		goto end;
 	__tracepoint_cb_lttng_ust_tracef___event(msg, len,
 		LTTNG_UST_CALLER_IP());
 	free(msg);

end:

liblttng-ust/tracef.c +10 -0
+	return;
+}
+
+void _lttng_ust_tracef(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	_lttng_ust_vtracef(fmt, ap);
+
Quoted 2 lines
	va_end(ap);
}

Can you check the result of the generated binary (compiled with -O2) to see if there is an additional call added for _lttng_ust_trace() compared to the prior generated code ? I would hate to add an extra call indirection there.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#4 lore raw
In reply to Maxime Roussin-Belanger
Quoted 26 lines · ----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger…
doc/examples/demo-tracef/demo-vtracef.c new file +2 -0
new file mode 100644
index 00000000..224e9292
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2020  Maxime Roussin-Belanger

<[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */

doc/examples/demo-tracef/demo-vtracef.c line 26

Quoted 9 lines
doc/examples/demo-tracef/demo-vtracef.c new file +9 -0
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <lttng/tracef.h>
+
+

Remove one whiteline here.

Quoted 8 lines
doc/examples/demo-tracef/demo-vtracef.c new file +8 -0
+void print_debug(const char* msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+
+	vtracef(msg, ap);
+
+	va_end(ap);

doc/examples/demo-tracef/demo-vtracef.c line 44

Quoted 10 lines
doc/examples/demo-tracef/demo-vtracef.c new file +10 -0
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+	int delay = 0;
+	const char *str = "mystring test";
+	long l = 0x42;
+
+	if (argc == 2)

Should handle cases where argc > 2 as well.

Quoted 5 lines
doc/examples/demo-tracef/demo-vtracef.c new file +5 -0
+		delay = atoi(argv[1]);
+
+	fprintf(stderr, "Demo program starting.\n");
+
+	sleep(delay);

doc/examples/demo-tracef/demo-vtracef.c line 59

Quoted 10 lines
doc/examples/demo-tracef/demo-vtracef.c new file +10 -0
+
+	fprintf(stderr, "Tracing... ");
+
+	for (i = 0; i < 5; i++) {
+		print_debug("This is a \"%s\" formatted %d event %lx", str, i, l);
+	}
+
+	fprintf(stderr, " done.\n");
+	return 0;
+}

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#5 lore raw
In reply to Maxime Roussin-Belanger

----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger [email protected] wrote:
[...]

Quoted 13 lines
liblttng-ust/tracef.c +1 -2
index ea98e43e..1311f0d5 100644
@@ -29,20 +29,26 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracef-provider.h"
 
-void _lttng_ust_tracef(const char *fmt, ...)
+void _lttng_ust_vtracef(const char *fmt, va_list ap)
 {
-	va_list ap;
 	char *msg;

liblttng-ust/tracef.c line 40

Quoted 10 lines
liblttng-ust/tracef.c +1 -4
-	int len;
-
-	va_start(ap, fmt);
-	len = vasprintf(&msg, fmt, ap);
+	const int len = vasprintf(&msg, fmt, ap);
 	/* len does not include the final \0 */
 	if (len < 0)
 		goto end;
 	__tracepoint_cb_lttng_ust_tracef___event(msg, len,
 		LTTNG_UST_CALLER_IP());

I don't think LTTNG_UST_CALLER_IP() has the behavior we would expect for _lttng_ust_tracef() anymore here. We want the callsite in the application or library which has been instrumented, not an IP within lttng-ust.

Thanks,

Mathieu

Quoted 21 lines
liblttng-ust/tracef.c +0 -0
 	free(msg);

end:

liblttng-ust/tracef.c +10 -0
+	return;
+}
+
+void _lttng_ust_tracef(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	_lttng_ust_vtracef(fmt, ap);
+
	va_end(ap);
}

--
2.20.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#6 lore raw
Quoted 22 lines · ----- On Feb 26, 2020, at 4:14 PM, Mathieu Desnoyers…

----- On Feb 24, 2020, at 12:34 PM, Maxime Roussin-Belanger [email protected] wrote:
[...]

Quoted 19 lines
liblttng-ust/tracef.c +2 -6
index ea98e43e..1311f0d5 100644
@@ -29,20 +29,26 @@
 #define TRACEPOINT_DEFINE
 #include "lttng-ust-tracef-provider.h"
 
-void _lttng_ust_tracef(const char *fmt, ...)
+void _lttng_ust_vtracef(const char *fmt, va_list ap)
 {
-	va_list ap;
 	char *msg;
-	int len;
-
-	va_start(ap, fmt);
-	len = vasprintf(&msg, fmt, ap);
+	const int len = vasprintf(&msg, fmt, ap);
 	/* len does not include the final \0 */
Quoted 8 lines

liblttng-ust/tracef.c line 40

Quoted 4 lines
liblttng-ust/tracef.c +0 -0
 	if (len < 0)
 		goto end;
 	__tracepoint_cb_lttng_ust_tracef___event(msg, len,
 		LTTNG_UST_CALLER_IP());

I don't think LTTNG_UST_CALLER_IP() has the behavior we would expect for _lttng_ust_tracef() anymore here. We want the callsite in the application or library which has been instrumented, not an IP within lttng-ust.

The following should fix both inlining and CALLER_IP() issues:

static inline __attribute__((always_inline)) void __lttng_ust_vtracef(const char *fmt, va_list ap)

{
        char *msg;
        const int len = vasprintf(&msg, fmt, ap);
        /* len does not include the final \0 */
        if (len < 0)
                goto end;
        __tracepoint_cb_lttng_ust_tracef___event(msg, len,
                LTTNG_UST_CALLER_IP());
        free(msg);
end:
        return;
}

void _lttng_ust_vtracef(const char *fmt, va_list ap)

{
        __lttng_ust_vtracef(fmt, ap);
}

void _lttng_ust_tracef(const char *fmt, ...)

{
        va_list ap;

        va_start(ap, fmt);
        __lttng_ust_vtracef(fmt, ap);

        va_end(ap);
}

Thanks,

Mathieu

Quoted 35 lines

Thanks,

Mathieu

Quoted 14 lines
liblttng-ust/tracef.c +0 -0
 	free(msg);

end:

liblttng-ust/tracef.c +10 -0
+	return;
+}
+
+void _lttng_ust_tracef(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	_lttng_ust_vtracef(fmt, ap);
+
	va_end(ap);
}
Quoted 7 lines

--
2.20.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com