summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch
blob: 6ac72195b7f447cf2b729c5c72e657179c9f4ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From a9f59fc8605de1bcca0b6c2d8132585f40c3b9bc Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Thu, 13 Aug 2020 11:25:58 +0800
Subject: [PATCH] tools/trace.py: Fix failing to exit

Class Probe::print_event is used as a callback of a ctypes wrapper. With
Yocto latest python v3.8.5, the exception raised by exit() is ignored and
thus trace cannot exit. Use os._exit(0) instead.

$ /usr/share/bcc/tools/trace do_sys_open -M 1
PID TID COMM FUNC
3740 3740 irqbalance do_sys_open
Exception ignored on calling ctypes callback function:
<function PerfEventArray.open_perf_buffer.<locals>.raw_cb at 0x7f7c9efea280>
Traceback (most recent call last):
File "/usr/lib64/python3.8/site-packages/bcc/table.py", line 685, in raw_cb_
callback(cpu, data, size)
File "/usr/share/bcc/tools/trace", line 630, in print_event
exit()
File "/usr/lib64/python3.8/sitebuiltins.py", line 26, in __call_
raise SystemExit(code)
SystemExit: None

Upstream-Status: Pending

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 tools/trace.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/trace.py
+++ b/tools/trace.py
@@ -671,7 +671,7 @@ BPF_PERF_OUTPUT(%s);
                     if self.aggregate:
                         self.print_aggregate_events()
                     sys.stdout.flush()
-                    exit()
+                    os._exit(0)
 
         def attach(self, bpf, verbose):
                 if len(self.library) == 0: