Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
2cd73d5975
!70 Sync code
From: @starlet-dx 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-04-01 10:30:34 +00:00
starlet-dx
e62b4f540e Sync code 2024-04-01 16:38:28 +08:00
openeuler-ci-bot
62b863f2f1
!35 Fixed a memory leak on input handler close
From: @Bolehu 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-01-06 08:28:26 +00:00
openeuler-ci-bot
d2bcb15dc9
!31 Fix version string memory leak
From: @Bolehu 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-01-06 07:51:31 +00:00
openeuler-ci-bot
9990706047
!26 Fix typos in error messages
From: @Bolehu 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-01-06 06:47:50 +00:00
Bolehu
70be05b24e Fixed a memory leak on input handler close
Signed-off-by: Bolehu <heyaohua@xfusion.com>
2023-01-06 04:56:37 +08:00
Bolehu
ff1c65752d Fix version string memory leak
Signed-off-by: Bolehu <heyaohua@xfusion.com>
2023-01-06 04:03:28 +08:00
Bolehu
1003bc9148 Fix typos in error messages
Signed-off-by: Bolehu <heyaohua@xfusion.com>
2023-01-06 02:29:13 +08:00
openeuler-ci-bot
31a78df57d
!25 fix bad data format in %changelog
From: @ikernel-mryao 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2022-12-24 08:51:13 +00:00
yaoguangzhong
45c73d9603 fix bad data format in %changelog
Signed-off-by: Guangzhong Yao <yaoguangzhong@xfusion.com>
2022-12-24 14:35:12 +08:00
7 changed files with 257 additions and 2 deletions

View File

@ -0,0 +1,33 @@
From 67b2de06ccd249f2b0dcc9b3e196e4fbcb943066 Mon Sep 17 00:00:00 2001
From: Peter Bergin <peter@berginkonsult.se>
Date: Fri, 30 Apr 2021 17:24:30 +0200
Subject: [PATCH] trace-cmd: Changing default install path of plugins
README file states that default install path for plugins
is '/usr/local/lib/trace-cmd/plugins' but Makefile did
specify other location.
Link: https://lore.kernel.org/linux-trace-devel/20210430152430.1958285-1-peter@berginkonsult.se
Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index ec73b5c6..0d8fea0d 100644
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,7 @@ plugin_tracecmd_dir = $(libdir)/trace-cmd/plugins
python_dir ?= $(libdir)/traceevent/python
var_dir = $(HOME)/.trace-cmd/
else
-plugin_traceevent_dir = $(libdir)/traceevent/plugins
+plugin_traceevent_dir = $(libdir)/trace-cmd/plugins
python_dir ?= $(libdir)/trace-cmd/python
PLUGIN_DIR_TRACEEVENT = -DPLUGIN_TRACEEVENT_DIR="$(plugin_traceevent_dir)"
PLUGIN_DIR_TRACECMD = -DPLUGIN_TRACECMD_DIR="$(plugin_tracecmd_dir)"
--
2.33.0

View File

@ -0,0 +1,35 @@
From 7e12e8ba4001f51869f28770246f0ac3dbfb9999 Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Fri, 14 May 2021 10:52:41 +0300
Subject: [PATCH] trace-cmd: Fix broken profile command
Recent changes in creating trace.dat files broke the streams, used
internaly by the trace-cmd profile command.
Link: https://lore.kernel.org/linux-trace-devel/20210514075241.65418-1-tz.stoyanov@gmail.com
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213045
Reported-by: Jerome Marchand <jmarchan@redhat.com>
Fixes: 1762536da ("trace-cmd: Have tracecmd_read_headers() specify the state to read up to")
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/trace-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tracecmd/trace-stream.c b/tracecmd/trace-stream.c
index f503bf77..b47b208c 100644
--- a/tracecmd/trace-stream.c
+++ b/tracecmd/trace-stream.c
@@ -59,7 +59,7 @@ trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus,
goto fail;
}
- if (tracecmd_read_headers(trace_input, 0) < 0)
+ if (tracecmd_read_headers(trace_input, TRACECMD_FILE_PRINTK) < 0)
goto fail_free_input;
if (handle_init)
--
2.33.0

View File

@ -0,0 +1,38 @@
From 43fa39ef1717e98ffe71ab0b53fefdfe1f02be3d Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Thu, 25 Mar 2021 08:40:44 +0200
Subject: [PATCH] trace-cmd: Remove unneeded multiply in events timestamp
reading
When the event timestamp is converted to seconds, the local variable
that holds this timestamp is converted to seconds also. As this
variable is not used in the function later, this conversion in not
needed.
Link: https://lore.kernel.org/linux-trace-devel/20210325064055.539554-13-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-input.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index c1ea07fd..c4fb9639 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1932,10 +1932,8 @@ read_again:
handle->cpu_data[cpu].timestamp = timestamp_correct(ts, handle);
- if (handle->ts2secs) {
+ if (handle->ts2secs)
handle->cpu_data[cpu].timestamp *= handle->ts2secs;
- ts *= handle->ts2secs;
- }
index = kbuffer_curr_offset(kbuf);
--
2.33.0

View File

@ -0,0 +1,39 @@
From c5d548379b25705c2061b8c010f78fd242212f65 Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Tue, 14 Sep 2021 16:12:14 +0300
Subject: [PATCH] trace-cmd library: Fix version string memory leak
The version string is allocated when a VERSION option is processed, but
is never freed. Free it on input handler close.
Link: https://lore.kernel.org/linux-trace-devel/20210914131232.3964615-4-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-input.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 0dbcdbdc..9253bc37 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3518,6 +3518,7 @@ void tracecmd_close(struct tracecmd_input *handle)
free(handle->cpu_data);
free(handle->uname);
free(handle->trace_clock);
+ free(handle->version);
close(handle->fd);
tracecmd_free_hooks(handle->hooks);
@@ -3959,6 +3960,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
new_handle->cpu_data = NULL;
new_handle->nr_buffers = 0;
new_handle->buffers = NULL;
+ new_handle->version = NULL;
new_handle->ref = 1;
if (handle->trace_clock) {
new_handle->trace_clock = strdup(handle->trace_clock);
--
2.33.0

View File

@ -0,0 +1,43 @@
From 402be29ae6fa1e29c963c71be2713687a4a71686 Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Tue, 14 Sep 2021 16:12:15 +0300
Subject: [PATCH] trace-cmd library: Fixed a memory leak on input handler close
When an input handler to a trace file is closed with tracecmd_close(),
the list with buffers is not freed. This leads to a memory leak. Added
logic to free that list.
Link: https://lore.kernel.org/linux-trace-devel/20210914131232.3964615-5-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-input.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 9253bc37..ffe87e8a 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3484,6 +3484,7 @@ void tracecmd_ref(struct tracecmd_input *handle)
void tracecmd_close(struct tracecmd_input *handle)
{
int cpu;
+ int i;
if (!handle)
return;
@@ -3521,6 +3522,10 @@ void tracecmd_close(struct tracecmd_input *handle)
free(handle->version);
close(handle->fd);
+ for (i = 0; i < handle->nr_buffers; i++)
+ free(handle->buffers[i].name);
+ free(handle->buffers);
+
tracecmd_free_hooks(handle->hooks);
handle->hooks = NULL;
--
2.33.0

View File

@ -0,0 +1,41 @@
From 9fd5f8ecd0bb98b6fdcfe75118b535f613226b9f Mon Sep 17 00:00:00 2001
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Tue, 14 Sep 2021 16:12:13 +0300
Subject: [PATCH] trace-cmd report: Fix typos in error messages
Fixed typos in "trace-cmd report" messages that report reading and
parsing errors.
Link: https://lore.kernel.org/linux-trace-devel/20210914131232.3964615-3-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/trace-read.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 6f43c1d2..31724b09 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1290,7 +1290,7 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
die("error in reading buffer instance");
new_handle = tracecmd_buffer_instance_handle(handles->handle, i);
if (!new_handle) {
- warning("could not retreive handle %s", name);
+ warning("could not retrieve handle %s", name);
continue;
}
add_handle(new_handle, name);
@@ -1324,7 +1324,7 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
if (last_record) {
int cpu = last_record->cpu;
if (cpu >= last_handle->cpus)
- die("cpu %d creater than %d\n", cpu, last_handle->cpus);
+ die("cpu %d greater than %d\n", cpu, last_handle->cpus);
if (tscheck &&
last_handle->last_timestamp[cpu] > last_record->ts) {
errno = 0;
--
2.33.0

View File

@ -1,11 +1,19 @@
Name: trace-cmd
Version: 2.9.2
Release: 3
Release: 9
Summary: A front-end for Ftrace
License: GPLv2 and LGPLv2
URL: http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary
Source0: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/%{name}-v%{version}.tar.gz
Source1: kernelshark.desktop
Patch0001: backport-trace-cmd-report-Fix-typos-in-error-messages.patch
Patch0002: backport-trace-cmd-library-Fix-version-string-memory-leak.patch
Patch0003: backport-trace-cmd-library-Fixed-a-memory-leak-on-input-handl.patch
Patch0004: backport-Remove-unneeded-multiply-in-events-timesta.patch
Patch0005: backport-Changing-default-install-path-of-plugins.patch
Patch0006: backport-Fix-broken-profile-command.patch
BuildRequires: gcc xmlto asciidoc mlocate libxml2-devel chrpath
BuildRequires: gtk2-devel glib2-devel desktop-file-utils libtraceevent-devel
Provides: kernelshark
@ -64,6 +72,24 @@ echo "%{_bindir}/%{name}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.co
%{_mandir}/man5/*
%changelog
* Mon Jan 09 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-9
- Fix broken profile command
* Sat Jan 07 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-8
- Changing default install path of plugins
* Sat Jan 07 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-7
- Remove unneeded multiply in events timestamp reading
* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-6
- trace-cmd library: Fixed a memory leak on input handler close
* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-5
- trace-cmd library: Fix version string memory leak
* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-4
- trace-cmd report: Fix typos in error messages
* Tue Dec 06 2022 yaoxin <yaoxin30@h-partners.com> - 2.9.2-3
- Add /sbin/ldconfig to post and postun
@ -73,7 +99,7 @@ echo "%{_bindir}/%{name}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.co
* Tue Jan 18 2022 houyingchao <houyingchao@huawei.com> - 2.9.2-1
- Upgrade to 2.9.2 version
* Fri July 30 2021 Guoxiaoqi <guoxiaoqi2@huawei.com> - 2.7-6
* Fri Jul 30 2021 Guoxiaoqi <guoxiaoqi2@huawei.com> - 2.7-6
- Fix build with gcc-10
* Wed Oct 28 2020 Anan Fu <fuanan3@huawei.com> - 2.7-5