Fix trace tools

Resolves: RHEL-8605
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
Jerome Marchand 2023-11-06 11:46:32 +01:00
parent 2053933c95
commit 3cb0495cc6
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 88274e83ca1a61699741d5b1d5499beb64cac753 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Mon, 16 Oct 2023 19:41:29 +0200
Subject: [PATCH] tools/trace: don't raise an exception in a ctype callback
To exit the tool when the maximal number of event is reached (-M
option), the tool currently call exit(), which raise a SystemExit
exception. The handling of exception from ctype callback doesn't seem
straightforward and dependent on python version.
This patch avoid the issue altogether by using a global variable
instead.
Closes #3049
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
tools/trace.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/trace.py b/tools/trace.py
index 9c7cca71..2aa096fa 100755
--- a/tools/trace.py
+++ b/tools/trace.py
@@ -43,6 +43,7 @@ import sys
build_id_enabled = False
aggregate = False
symcount = {}
+ done = False
@classmethod
def configure(cls, args):
@@ -635,7 +636,7 @@ BPF_PERF_OUTPUT(%s);
if self.aggregate:
self.print_aggregate_events()
sys.stdout.flush()
- exit()
+ Probe.done = True;
def attach(self, bpf, verbose):
if len(self.library) == 0:
@@ -895,7 +896,7 @@ trace -s /lib/x86_64-linux-gnu/libc.so.6,/bin/ping 'p:c:inet_pton' -U
"-" if not all_probes_trivial else ""))
sys.stdout.flush()
- while True:
+ while not Probe.done:
self.bpf.perf_buffer_poll()
def run(self):
--
2.41.0

View File

@ -25,7 +25,7 @@
Name: bcc Name: bcc
Version: 0.28.0 Version: 0.28.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: BPF Compiler Collection (BCC) Summary: BPF Compiler Collection (BCC)
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/iovisor/bcc URL: https://github.com/iovisor/bcc
@ -33,6 +33,7 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: %%{name}-%%{version}-tools-tcpstates-fix-context-ptr-modified-error.patch Patch0: %%{name}-%%{version}-tools-tcpstates-fix-context-ptr-modified-error.patch
Patch1: %%{name}-%%{version}-tools-tcpstates-fix-IPv6-journal.patch Patch1: %%{name}-%%{version}-tools-tcpstates-fix-IPv6-journal.patch
Patch2: %%{name}-%%{version}-tools-Add-support-for-the-new-block_io_-tracepoints.patch Patch2: %%{name}-%%{version}-tools-Add-support-for-the-new-block_io_-tracepoints.patch
Patch3: %%{name}-%%{version}-tools-trace-don-t-raise-an-exception-in-a-ctype-call.patch
# Arches will be included as upstream support is added and dependencies are # Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches # satisfied in the respective arches
@ -256,6 +257,9 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
%endif %endif
%changelog %changelog
* Mon Nov 06 2023 Jerome Marchand <jmarchan@redhat.com> - 0.28.0-2
- Fix trace tool (RHEL-8605)
* Mon Oct 23 2023 Jerome Marchand <jmarchan@redhat.com> - 0.28.0-1 * Mon Oct 23 2023 Jerome Marchand <jmarchan@redhat.com> - 0.28.0-1
- Rebase to v0.28.0 (RHEL-9976) - Rebase to v0.28.0 (RHEL-9976)
- Rebuild with LLVM 17 (RHEL-10591) - Rebuild with LLVM 17 (RHEL-10591)