@@ -10,12 +10,17 @@
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
+#include <sys/syscall.h>
#include "trace-local.h"
int silence_warnings;
int show_status;
+#ifndef gettid
+#define gettid() syscall(__NR_gettid)
+#endif
+
void warning(const char *fmt, ...)
{
va_list ap;
@@ -45,6 +50,19 @@ void *malloc_or_die(unsigned int size)
return data;
}
+void tracecmd_debug(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!tracecmd_get_debug())
+ return;
+
+ va_start(ap, fmt);
+ printf("[%d] ", (int)gettid());
+ vprintf(fmt, ap);
+ va_end(ap);
+}
+
static struct trace_log_severity {
int id;
const char *name;