Segmentation fault in read Lttng events with Pytho

2019-09-07 07:33发布

问题:

I used Ubunto 16.04, Lttng 2.8.1 and python3.5.2. I also installed python3-babeltrace package. The first step was I recorded some logs exactly based on Lttng documents with lttng create, evenet-enable, start, stop, destroy. In the second step I write a very simple python program to read lttng events, some thing like this:

from collections import Counter
import babeltrace
import sys

print("Start")

trace_path = sys.argv[1]

print("1-Get Path")

col = babeltrace.TraceCollection()

print("2-TraceCollection")

# (LTTng traces always have the 'ctf' format)
if col.add_trace(trace_path, 'ctf') is None:
    raise RuntimeError('Cannot add trace')

print("3-Add trace by ctf")

for event in col.events:
    print(event.name)

print("4-Get all events") 

then I debug the program with gdb and after this outputs:

Start
1-Get Path
2-TraceCollection
3-Add trace by ctf

I got the error:

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff565d97f in bt_iter_add_trace () from /usr/lib/x86_64-linux-gnu/libbabeltrace.so.1

Does any one have any idea about this?

I uninstall all of the packages, also uninstall ubuntu and then installed again but each time I got the same error. I also try to install Ubuntu 16.10 but with that one I got another error in lttng-module package installation.

Update:

I found that none of babeltrace command and lttng view not worked, and caused the segmentation fault error.