All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Allow GUI plugins to build standalone
@ 2022-01-19 12:02 Yordan Karadzhov (VMware)
  2022-01-19 12:02 ` [RFC PATCH 1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp Yordan Karadzhov (VMware)
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-01-19 12:02 UTC (permalink / raw)
  To: linux-trace-devel, hongzhan.chen, jan.kiszka; +Cc: Yordan Karadzhov (VMware)

Hi Hongzhan and Jan,

I tried to build your plugin standalone and I realized that this is
in fact not possible due to some missing header files. This gets fixed
in the following patch-set. I also made some minor modifications in
the code of your plugin and will send you this modified version of
the plugin in a separate email. 

Please let me know if you find this modifications useful or not?

Cheers,
Yordan

Yordan Karadzhov (VMware) (2):
  kernel-shark: Add KsPluginsGUI.hpp/.cpp
  kernel-shark: Install missing headers

 src/CMakeLists.txt         | 12 ++++++++++++
 src/KsPluginsGUI.cpp       | 27 +++++++++++++++++++++++++++
 src/KsPluginsGUI.hpp       | 22 ++++++++++++++++++++++
 src/plugins/CMakeLists.txt |  4 ++++
 4 files changed, 65 insertions(+)
 create mode 100644 src/KsPluginsGUI.cpp
 create mode 100644 src/KsPluginsGUI.hpp

-- 
2.32.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC PATCH 1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp
  2022-01-19 12:02 [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov (VMware)
@ 2022-01-19 12:02 ` Yordan Karadzhov (VMware)
  2022-01-19 12:02 ` [RFC PATCH 2/2] kernel-shark: Install missing headers Yordan Karadzhov (VMware)
  2022-01-19 12:10 ` [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov
  2 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-01-19 12:02 UTC (permalink / raw)
  To: linux-trace-devel, hongzhan.chen, jan.kiszka; +Cc: Yordan Karadzhov (VMware)

Here we will place all GUI-related APIs that will be exposed to
the external plugins. For the moment we add only two such APIs
that will allow the plugins to manipulate the markers.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/CMakeLists.txt   |  1 +
 src/KsPluginsGUI.cpp | 27 +++++++++++++++++++++++++++
 src/KsPluginsGUI.hpp | 22 ++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 src/KsPluginsGUI.cpp
 create mode 100644 src/KsPluginsGUI.hpp

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9e0b4ae..4c26122 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -97,6 +97,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
                                                             KsTraceGraph.cpp
                                                             KsTraceViewer.cpp
                                                             KsMainWindow.cpp
+                                                            KsPluginsGUI.cpp
                                                             KsCaptureDialog.cpp
                                                             KsQuickContextMenu.cpp
                                                             KsAdvFilteringDialog.cpp)
diff --git a/src/KsPluginsGUI.cpp b/src/KsPluginsGUI.cpp
new file mode 100644
index 0000000..a964510
--- /dev/null
+++ b/src/KsPluginsGUI.cpp
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: LGPL-2.1
+
+/*
+ * Copyright 2022 VMware Inc, Yordan Karadzhov (VMware) <y.karadz@gmail.com>
+ */
+
+/**
+  *  @file    KsPluginsGUI.cpp
+  *  @brief   KernelShark C++ plugin declarations.
+  */
+
+// KernelShark
+#include "KsPluginsGUI.hpp"
+#include "KsMainWindow.hpp"
+#include "KsDualMarker.hpp"
+
+void markEntryA(void *ks_ptr, const kshark_entry *e)
+{
+	KsMainWindow *ks = static_cast<KsMainWindow *>(ks_ptr);
+	ks->markEntry(e, DualMarkerState::A);
+}
+
+void markEntryB(void *ks_ptr, const kshark_entry *e)
+{
+	KsMainWindow *ks = static_cast<KsMainWindow *>(ks_ptr);
+	ks->markEntry(e, DualMarkerState::B);
+}
diff --git a/src/KsPluginsGUI.hpp b/src/KsPluginsGUI.hpp
new file mode 100644
index 0000000..808a951
--- /dev/null
+++ b/src/KsPluginsGUI.hpp
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+
+/*
+ * Copyright 2022 VMware Inc, Yordan Karadzhov <y.karadz@gmail.com>
+ */
+
+/**
+  *  @file    KsPluginsGUI.hpp
+  *  @brief   KernelShark C++ plugin declarations.
+  */
+
+#ifndef _KS_PLUGINS_GUI_H
+#define _KS_PLUGINS_GUI_H
+
+// KernelShark
+#include "libkshark.h"
+
+void markEntryA(void *ks_ptr, const kshark_entry *e);
+
+void markEntryB(void *ks_ptr, const kshark_entry *e);
+
+#endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 2/2] kernel-shark: Install missing headers
  2022-01-19 12:02 [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov (VMware)
  2022-01-19 12:02 ` [RFC PATCH 1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp Yordan Karadzhov (VMware)
@ 2022-01-19 12:02 ` Yordan Karadzhov (VMware)
  2022-01-19 12:10 ` [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov
  2 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-01-19 12:02 UTC (permalink / raw)
  To: linux-trace-devel, hongzhan.chen, jan.kiszka; +Cc: Yordan Karadzhov (VMware)

Building an external plugin that uses libkshark-plot and libkshark-gui
libraries haven't been realy tested so far. It turns that headers that
are required in order to do this are not installed. The installation of
those headers is made part of the 'libkshark-devel' component.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/CMakeLists.txt         | 11 +++++++++++
 src/plugins/CMakeLists.txt |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4c26122..3a20458 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -67,6 +67,14 @@ if (OPENGL_FOUND)
             LIBRARY DESTINATION    ${_LIBDIR}
                 COMPONENT              kernelshark)
 
+    install(FILES "${KS_DIR}/src/stb_truetype.h"
+                  "${KS_DIR}/src/libkshark-plot.h"
+                  "${KS_DIR}/src/KsPlotTools.hpp"
+                  "${KS_DIR}/src/KsPlugins.hpp"
+                  "${KS_DIR}/src/KsCmakeDef.hpp"
+            DESTINATION ${KS_INCLUDS_DESTINATION}
+                COMPONENT libkshark-devel)
+
 endif (OPENGL_FOUND)
 
 if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
@@ -139,6 +147,9 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
     install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
             DESTINATION ${_INSTALL_PREFIX}/bin/
                 COMPONENT                 kernelshark)
+    install(FILES "${KS_DIR}/src/KsPluginsGUI.hpp"
+            DESTINATION ${KS_INCLUDS_DESTINATION}
+                COMPONENT libkshark-devel)
 
     add_subdirectory(plugins)
     set(PLUGINS ${PLUGINS} PARENT_SCOPE)
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 3e170fa..e9d9068 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -69,4 +69,8 @@ install(TARGETS ${PLUGIN_LIST}
         LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX}
         COMPONENT kernelshark)
 
+install(FILES "${KS_DIR}/src/plugins/common_sched.h"
+        DESTINATION "${KS_INCLUDS_DESTINATION}/plugins"
+            COMPONENT libkshark-devel)
+
 set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 0/2] Allow GUI plugins to build standalone
  2022-01-19 12:02 [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov (VMware)
  2022-01-19 12:02 ` [RFC PATCH 1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp Yordan Karadzhov (VMware)
  2022-01-19 12:02 ` [RFC PATCH 2/2] kernel-shark: Install missing headers Yordan Karadzhov (VMware)
@ 2022-01-19 12:10 ` Yordan Karadzhov
  2022-02-11  5:03   ` Chen, Hongzhan
  2 siblings, 1 reply; 7+ messages in thread
From: Yordan Karadzhov @ 2022-01-19 12:10 UTC (permalink / raw)
  To: linux-trace-devel, hongzhan.chen, jan.kiszka

[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]

And here is the version of the plugin that can build standalone. In order to load it just do:

kernelshark -p path/to/xenomai_cobalt_plugin/plugin-xenomai_cobalt_switch_events.so

You can also load it from the menus.
Note that I only tested that it builds and loads successfully but I have no data file that contains 'cobalt' events.

Cheers,
Yordan


On 19.01.22 г. 14:02 ч., Yordan Karadzhov (VMware) wrote:
> Hi Hongzhan and Jan,
> 
> I tried to build your plugin standalone and I realized that this is
> in fact not possible due to some missing header files. This gets fixed
> in the following patch-set. I also made some minor modifications in
> the code of your plugin and will send you this modified version of
> the plugin in a separate email.
> 
> Please let me know if you find this modifications useful or not?
> 
> Cheers,
> Yordan
> 
> Yordan Karadzhov (VMware) (2):
>    kernel-shark: Add KsPluginsGUI.hpp/.cpp
>    kernel-shark: Install missing headers
> 
>   src/CMakeLists.txt         | 12 ++++++++++++
>   src/KsPluginsGUI.cpp       | 27 +++++++++++++++++++++++++++
>   src/KsPluginsGUI.hpp       | 22 ++++++++++++++++++++++
>   src/plugins/CMakeLists.txt |  4 ++++
>   4 files changed, 65 insertions(+)
>   create mode 100644 src/KsPluginsGUI.cpp
>   create mode 100644 src/KsPluginsGUI.hpp
> 

[-- Attachment #2: xenomai_cobalt_plugin.tz --]
[-- Type: application/octet-stream, Size: 3771 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH 0/2] Allow GUI plugins to build standalone
  2022-01-19 12:10 ` [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov
@ 2022-02-11  5:03   ` Chen, Hongzhan
  2022-02-11 12:30     ` Yordan Karadzhov
  0 siblings, 1 reply; 7+ messages in thread
From: Chen, Hongzhan @ 2022-02-11  5:03 UTC (permalink / raw)
  To: Yordan Karadzhov, linux-trace-devel, Kiszka, Jan



>-----Original Message-----
>From: Yordan Karadzhov <y.karadz@gmail.com> 
>Sent: Wednesday, January 19, 2022 8:10 PM
>To: linux-trace-devel@vger.kernel.org; Chen, Hongzhan <hongzhan.chen@intel.com>; Kiszka, Jan <jan.kiszka@siemens.com>
>Subject: Re: [RFC PATCH 0/2] Allow GUI plugins to build standalone
>
>And here is the version of the plugin that can build standalone. In order to load it just do:
>
>kernelshark -p path/to/xenomai_cobalt_plugin/plugin-xenomai_cobalt_switch_events.so
>
>You can also load it from the menus.
>Note that I only tested that it builds and loads successfully but I have no data file that contains 'cobalt' events.

Sorry for late response. It builds and loads successfully based on your patchset according to my test. It is really great
that we can build it standalone. It also visualize cobalt blue hollow box for xenomai OOB state correctly after run.
It is very useful.

But when I double click the box , kernel-shark quit abnormally with segmentation fault.

Following is backtrace info:

[Thread 0x7fffc084d700 (LWP 2064) exited]

Thread 1 "kernelshark" received signal SIGSEGV, Segmentation fault.
KsMainWindow::markEntry (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
229             ssize_t size() const {return _dataSize;}
(gdb) backtrace
#0  0x00007ffff7b91442 in KsMainWindow::markEntry(kshark_entry const*, DualMarkerState) (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B)
    at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
#1  0x00007fffc0876329 in XenomaiSwitchBox::_doubleClick() const (this=0x1c7ebc0) at CobaltSwitchEvents.cpp:43
#2  0x00007ffff5a2594f in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#3  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#4  0x00007ffff59ee65f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#5  0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff59ed632 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff5a4015b in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff5a427ca in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff59ee104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff522a780 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#13 0x00007ffff522c0b5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007ffff520333b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#15 0x00007fffed8ae260 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#16 0x00007ffff13b7537 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff13b7770 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff13b77fc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff493585f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff48da8da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff48e3984 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x0000000000402af5 in main (argc=<optimized out>, argv=<optimized out>) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:154
#23 0x00007ffff369abf7 in __libc_start_main (main=
    0x402480 <main>, argc=1, argv=0x7fffffffdd18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd08) at ../csu/libc-start.c:310
#24 0x0000000000402cfa in _start () at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:129
(gdb)

Regards

Hongzhan Chen
>
>Cheers,
>Yordan
>
>
>On 19.01.22 ?. 14:02 ?., Yordan Karadzhov (VMware) wrote:
>> Hi Hongzhan and Jan,
>> 
>> I tried to build your plugin standalone and I realized that this is
>> in fact not possible due to some missing header files. This gets fixed
>> in the following patch-set. I also made some minor modifications in
>> the code of your plugin and will send you this modified version of
>> the plugin in a separate email.
>> 
>> Please let me know if you find this modifications useful or not?
>> 
>> Cheers,
>> Yordan
>> 
>> Yordan Karadzhov (VMware) (2):
>>    kernel-shark: Add KsPluginsGUI.hpp/.cpp
>>    kernel-shark: Install missing headers
>> 
>>   src/CMakeLists.txt         | 12 ++++++++++++
>>   src/KsPluginsGUI.cpp       | 27 +++++++++++++++++++++++++++
>>   src/KsPluginsGUI.hpp       | 22 ++++++++++++++++++++++
>>   src/plugins/CMakeLists.txt |  4 ++++
>>   4 files changed, 65 insertions(+)
>>   create mode 100644 src/KsPluginsGUI.cpp
>>   create mode 100644 src/KsPluginsGUI.hpp
>>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 0/2] Allow GUI plugins to build standalone
  2022-02-11  5:03   ` Chen, Hongzhan
@ 2022-02-11 12:30     ` Yordan Karadzhov
  2022-02-14  1:19       ` Chen, Hongzhan
  0 siblings, 1 reply; 7+ messages in thread
From: Yordan Karadzhov @ 2022-02-11 12:30 UTC (permalink / raw)
  To: Chen, Hongzhan, linux-trace-devel, Kiszka, Jan

[-- Attachment #1: Type: text/plain, Size: 4029 bytes --]



On 11.02.22 г. 7:03 ч., Chen, Hongzhan wrote:
> But when I double click the box , kernel-shark quit abnormally with segmentation fault.
> 
> Following is backtrace info:
> 
> [Thread 0x7fffc084d700 (LWP 2064) exited]
> 
> Thread 1 "kernelshark" received signal SIGSEGV, Segmentation fault.
> KsMainWindow::markEntry (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
> 229             ssize_t size() const {return _dataSize;}
> (gdb) backtrace
> #0  0x00007ffff7b91442 in KsMainWindow::markEntry(kshark_entry const*, DualMarkerState) (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B)
>      at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
> #1  0x00007fffc0876329 in XenomaiSwitchBox::_doubleClick() const (this=0x1c7ebc0) at CobaltSwitchEvents.cpp:43
> #2  0x00007ffff5a2594f in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #3  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #4  0x00007ffff59ee65f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #5  0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #6  0x00007ffff59ed632 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
>      at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #7  0x00007ffff5a4015b in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #8  0x00007ffff5a427ca in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #9  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #10 0x00007ffff59ee104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #11 0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #12 0x00007ffff522a780 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> #13 0x00007ffff522c0b5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> #14 0x00007ffff520333b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> #15 0x00007fffed8ae260 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
> #16 0x00007ffff13b7537 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #17 0x00007ffff13b7770 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #18 0x00007ffff13b77fc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> #19 0x00007ffff493585f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #20 0x00007ffff48da8da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #21 0x00007ffff48e3984 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #22 0x0000000000402af5 in main (argc=<optimized out>, argv=<optimized out>) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:154
> #23 0x00007ffff369abf7 in __libc_start_main (main=
>      0x402480 <main>, argc=1, argv=0x7fffffffdd18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd08) at ../csu/libc-start.c:310
> #24 0x0000000000402cfa in _start () at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:129
> (gdb)
> 

Hi Hongzhan,

I have an idea what can be the problem here.
Please try applying the attached patch and let me know if the double click works.

Thanks!
Yordan


> Regards
> 
> Hongzhan Chen

[-- Attachment #2: 0001-kernel-shark-Load-ctrl-interface-for-user-plugins-Wi.patch --]
[-- Type: text/x-patch, Size: 3753 bytes --]

From 9caaf7041d5f8821ee79007f36f9c465364ee548 Mon Sep 17 00:00:00 2001
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Date: Fri, 11 Feb 2022 14:09:56 +0200
Subject: [PATCH] kernel-shark: Load ctrl interface for user plugins (WiP)

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/KsUtils.cpp | 37 +++++++++++++++++++++++--------------
 src/KsUtils.hpp |  4 +++-
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/KsUtils.cpp b/src/KsUtils.cpp
index a22c445..f62987b 100644
--- a/src/KsUtils.cpp
+++ b/src/KsUtils.cpp
@@ -1057,11 +1057,11 @@ void KsDataStore::setClockOffset(int sd, int64_t offset)
 KsPluginManager::KsPluginManager(QWidget *parent)
 : QObject(parent)
 {
-	_loadPluginList(KsUtils::getPluginList());
+	_loadPluginList(KsUtils::getPluginList(), false);
 }
 
 QVector<kshark_plugin_list *>
-KsPluginManager::_loadPluginList(const QStringList &plugins)
+KsPluginManager::_loadPluginList(const QStringList &plugins, bool regCtrl)
 {
 	kshark_context *kshark_ctx(nullptr);
 	QVector<kshark_plugin_list *> vec;
@@ -1090,8 +1090,11 @@ KsPluginManager::_loadPluginList(const QStringList &plugins)
 							name.c_str(),
 							lib.c_str());
 
-			if (plugin)
+			if (plugin) {
 				vec.append(plugin);
+				if (regCtrl)
+					_registerCtrlInterface(plugin);
+			}
 		}
 	}
 
@@ -1190,6 +1193,19 @@ QVector<int> KsPluginManager::getPluginsByStatus(int sd, int status) const
 	return vec;
 }
 
+void KsPluginManager::_registerCtrlInterface(kshark_plugin_list *plugin)
+{
+	if (!plugin->handle || !plugin->ctrl_interface)
+		return;
+
+	void *dialogPtr = plugin->ctrl_interface(parent());
+	if (dialogPtr) {
+		QWidget *dialog = static_cast<QWidget *>(dialogPtr);
+		if (_pluginDialogs.indexOf(dialog) < 0)
+			_pluginDialogs.append(dialog);
+	}
+}
+
 /**
  * @brief Loop over the registered plugins and register all plugin-defined
  *	  menus (if any).
@@ -1203,14 +1219,7 @@ void KsPluginManager::registerPluginMenues()
 		return;
 
 	for (plugin = kshark_ctx->plugins; plugin; plugin = plugin->next)
-		if (plugin->handle && plugin->ctrl_interface) {
-			void *dialogPtr = plugin->ctrl_interface(parent());
-			if (dialogPtr) {
-				QWidget *dialog =
-					static_cast<QWidget *>(dialogPtr);
-				_pluginDialogs.append(dialog);
-			}
-		}
+		_registerCtrlInterface(plugin);
 }
 
 std::string KsPluginManager::_pluginLibFromName(const QString &plugin)
@@ -1247,11 +1256,11 @@ std::string KsPluginManager::_pluginNameFromLib(const QString &plugin)
  * @param pluginNames: Provide here the names of the plugin (as in the
  *		       CMake-generated header file) or the names of the
  *		       plugin's library files (.so including path).
- * 		       The names must be comma separated.
+ *		       The names must be comma separated.
  */
 void KsPluginManager::registerPlugins(const QString &pluginNames)
 {
-	_userPlugins.append(_loadPluginList(pluginNames.split(',')));
+	_userPlugins.append(_loadPluginList(pluginNames.split(','), true));
 }
 
 /**
@@ -1368,7 +1377,7 @@ void KsPluginManager::addPlugins(const QStringList &fileNames,
 	if (!kshark_instance(&kshark_ctx))
 		return;
 
-	plugins = _loadPluginList(fileNames);
+	plugins = _loadPluginList(fileNames, true);
 	_userPlugins.append(plugins);
 
 	if (streamIds.isEmpty())
diff --git a/src/KsUtils.hpp b/src/KsUtils.hpp
index 1a97d9e..ec58c44 100644
--- a/src/KsUtils.hpp
+++ b/src/KsUtils.hpp
@@ -328,7 +328,9 @@ private:
 	QVector<QWidget *>		_pluginDialogs;
 
 	QVector<kshark_plugin_list *>
-	_loadPluginList(const QStringList &plugins);
+	_loadPluginList(const QStringList &plugins, bool regCtrl);
+
+	void _registerCtrlInterface(kshark_plugin_list *plugin);
 
 	std::string _pluginLibFromName(const QString &plugin);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [RFC PATCH 0/2] Allow GUI plugins to build standalone
  2022-02-11 12:30     ` Yordan Karadzhov
@ 2022-02-14  1:19       ` Chen, Hongzhan
  0 siblings, 0 replies; 7+ messages in thread
From: Chen, Hongzhan @ 2022-02-14  1:19 UTC (permalink / raw)
  To: Yordan Karadzhov, linux-trace-devel, Kiszka, Jan

>
>
>-----Original Message-----
>From: Yordan Karadzhov <y.karadz@gmail.com> 
>Sent: Friday, February 11, 2022 8:30 PM
>To: Chen, Hongzhan <hongzhan.chen@intel.com>; linux-trace-devel@vger.kernel.org; Kiszka, Jan <jan.kiszka@siemens.com>
>Subject: Re: [RFC PATCH 0/2] Allow GUI plugins to build standalone
>
>
>
>On 11.02.22 ?. 7:03 ?., Chen, Hongzhan wrote:
>> But when I double click the box , kernel-shark quit abnormally with segmentation fault.
>> 
>> Following is backtrace info:
>> 
>> [Thread 0x7fffc084d700 (LWP 2064) exited]
>> 
>> Thread 1 "kernelshark" received signal SIGSEGV, Segmentation fault.
>> KsMainWindow::markEntry (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
>> 229             ssize_t size() const {return _dataSize;}
>> (gdb) backtrace
>> #0  0x00007ffff7b91442 in KsMainWindow::markEntry(kshark_entry const*, DualMarkerState) (this=0x0, e=0x7fffadf90f60, st=DualMarkerState::B)
>>      at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/KsUtils.hpp:229
>> #1  0x00007fffc0876329 in XenomaiSwitchBox::_doubleClick() const (this=0x1c7ebc0) at CobaltSwitchEvents.cpp:43
>> #2  0x00007ffff5a2594f in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #3  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #4  0x00007ffff59ee65f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #5  0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>> #6  0x00007ffff59ed632 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
>>      at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #7  0x00007ffff5a4015b in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #8  0x00007ffff5a427ca in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #9  0x00007ffff59e683c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #10 0x00007ffff59ee104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
>> #11 0x00007ffff48dc8a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>> #12 0x00007ffff522a780 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
>> #13 0x00007ffff522c0b5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
>> #14 0x00007ffff520333b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
>> #15 0x00007fffed8ae260 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
>> #16 0x00007ffff13b7537 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #17 0x00007ffff13b7770 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #18 0x00007ffff13b77fc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #19 0x00007ffff493585f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>> #20 0x00007ffff48da8da in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>> #21 0x00007ffff48e3984 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>> #22 0x0000000000402af5 in main (argc=<optimized out>, argv=<optimized out>) at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:154
>> #23 0x00007ffff369abf7 in __libc_start_main (main=
>>      0x402480 <main>, argc=1, argv=0x7fffffffdd18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd08) at ../csu/libc-start.c:310
>> #24 0x0000000000402cfa in _start () at /home/intel/iotg/dovetail/kernelshark/kernel-shark/src/kernelshark.cpp:129
>> (gdb)
>> 
>
>Hi Hongzhan,
>
>I have an idea what can be the problem here.
>Please try applying the attached patch and let me know if the double click works.

The double click works after patching.  Appreciate your help.  Would you merge all the patches including the last patchset 
"Allow GUI plugins to build standalone" that you already merged it partially?

Regards

Hongzhan Chen

>
>Thanks!
>Yordan
>
>
>> Regards
>> 
>> Hongzhan Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-14  1:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 12:02 [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov (VMware)
2022-01-19 12:02 ` [RFC PATCH 1/2] kernel-shark: Add KsPluginsGUI.hpp/.cpp Yordan Karadzhov (VMware)
2022-01-19 12:02 ` [RFC PATCH 2/2] kernel-shark: Install missing headers Yordan Karadzhov (VMware)
2022-01-19 12:10 ` [RFC PATCH 0/2] Allow GUI plugins to build standalone Yordan Karadzhov
2022-02-11  5:03   ` Chen, Hongzhan
2022-02-11 12:30     ` Yordan Karadzhov
2022-02-14  1:19       ` Chen, Hongzhan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.