[PATCH 2/2] trace-cmd: python interface: add global variables to swig interface
From: Andreas Platschek
Date: Mon Nov 14 2016 - 07:01:41 EST
Since trace-read.o is now linked into the python library, the global
variable silence_warnings and show_status (defined in trace-cmd.c for
trace-cmd) used in trace-read.c are also defined in the swig interface.
This way the two variables are exposed to python as
tracecmd.cvar.silence_warnings and tracecmd.cvar.show_status .
If this is not done, running tracecmd.py will fail due to undefined
symbols:
root@wheezy:/home/andi/working_git/trace-cmd# python tracecmd.py
Traceback (most recent call last):
File "tracecmd.py", line 22, in <module>
from ctracecmd import *
ImportError: /home/andi/working_git/trace-cmd/ctracecmd.so: undefined symbol: silence_warnings
Signed-off-by: Andreas Platschek <andreas.platschek@xxxxxxxxxxx>
---
ctracecmd.i | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ctracecmd.i b/ctracecmd.i
index e91d068..7800470 100644
--- a/ctracecmd.i
+++ b/ctracecmd.i
@@ -35,6 +35,8 @@ static int python_callback(struct trace_seq *s,
void *context);
static int skip_output = 0;
+int silence_warnings;
+int show_status;
static void py_supress_trace_output(void)
{
--
1.7.10.4