``` $ sudo kernelshark QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ERROR: Capture process failed: Unknown error/usr/bin/kshark-su-record: line 3: [: =: unary operator expected QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 2909 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` `/usr/bin/kshark-su-record` looks like this: ```sh #!/bin/bash if [ $XDG_SESSION_TYPE = "wayland" ] then xhost +si:localuser:root &>/dev/null fi pkexec kshark-record -o ${PWD}/trace.dat ``` For some reason `$XDG_SESSION_TYPE` can be empty string, thus the "fix" would be to double-quote it like `"$XDG_SESSION_TYPE"`, ie. `if [ "$XDG_SESSION_TYPE" = "wayland" ]` I've verified that this doesn't cause the error anymore. The other errors are something else, no idea why currently, but apparently because of `sudo` and my running X/startx as normal `user` not root, `$XDG_RUNTIME_DIR` is also not set! The reason I tried `sudo kernelshark` is to avoid the dialog asking for root password. However even if running as non-root `$ kernelshark` after entering root password when asked, the next error is: ``` Capture process failed: Unknown errorQStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 3421 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` not sure why, because in `user`'s `xfce4-terminal`, it is set: ``` /home/user $ echo $XDG_RUNTIME_DIR /run/user/1000 ``` Might be some fallout from my currently trying to workaround issue https://bugzilla.kernel.org/show_bug.cgi?id=204259#c4
whoops, markdown fail ( \`\`\`sh broke it all), retrying with fixed: ``` $ sudo kernelshark QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ERROR: Capture process failed: Unknown error/usr/bin/kshark-su-record: line 3: [: =: unary operator expected QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 2909 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` `/usr/bin/kshark-su-record` looks like this: ``` #!/bin/bash if [ $XDG_SESSION_TYPE = "wayland" ] then xhost +si:localuser:root &>/dev/null fi pkexec kshark-record -o ${PWD}/trace.dat ``` For some reason `$XDG_SESSION_TYPE` can be empty string, thus the "fix" would be to double-quote it like `"$XDG_SESSION_TYPE"`, ie. `if [ "$XDG_SESSION_TYPE" = "wayland" ]` I've verified that this doesn't cause the error anymore. The other errors are something else, no idea why currently, but apparently because of `sudo` and my running X/startx as normal `user` not root, `$XDG_RUNTIME_DIR` is also not set! The reason I tried `sudo kernelshark` is to avoid the dialog asking for root password. However even if running as non-root `$ kernelshark` after entering root password when asked, the next error is: ``` Capture process failed: Unknown errorQStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 3421 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` not sure why, because in `user`'s `xfce4-terminal`, it is set: ``` /home/user $ echo $XDG_RUNTIME_DIR /run/user/1000 ``` Might be some fallout from my currently trying to workaround issue https://bugzilla.kernel.org/show_bug.cgi?id=204259#c4
as an aside, if interested why `kshark-record` dumped core, the stacktrace is here: https://gist.github.com/howaboutsynergy/f62e979c5a64b4dbee6f801c25967cc4
Ok it might be my bad(for the _other_ errors happening!) because I'm mixing Release and Debug. Ok, it actually happens when anything is Debug, because this only happens when I do it like this: ``` make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" all doc make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" gui make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" install install_doc install_gui ``` or like this: ``` make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" all doc make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" gui make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" install install_doc install_gui ``` or like this (Debug only): ``` make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" all doc make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" gui make BUILD_TYPE=Debug PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" install install_doc install_gui ``` but it doesn't happen when all Release: ``` make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" all doc make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" gui ``` ``` make BUILD_TYPE=Release PYTHON_VERS=python2 \ prefix="/usr" DESTDIR="$pkgdir" install install_doc install_gui ``` (note that for `Release` `gui` to compile here, it was necessary to patch `kernel-shark/build/FindTraceCmd.cmake` like this: https://bugzilla.kernel.org/show_bug.cgi?id=204259#c4 ie. comment out that `#if (CMAKE_BUILD_TYPE MATCHES Debug)` or else it won't find `trace-cmd`, if no `trace-cmd` executable was already installed system-wide)
Hi howaboutsynergy, First of all thank you very much for your time spent to investigate the problem and for the detailed report! Unfortunately I am not able to reproduce the bug and I have to ask you to do some additional investigations. 1. Have a look in the header file trace-cmd/kernel-shark/src/KsCmakeDef.hpp (this file is auto-generated by Cmake) and check if you see any difference between the case when you have the problem and the case when everything works. 2. For the case when you have the problem: Start the recording dialog directly form the command line: a: kshark-su-record b: pkexec kshark-record c: sudo kshark-record Please try a, b and c and tell is if this always fails. cheers, Yordan
> 1. Have a look in the header file trace-cmd/kernel-shark/src/KsCmakeDef.hpp (this file is auto-generated by Cmake) and check if you see any difference between the case when you have the problem and the case when everything works. No difference in `KsCmakeDef.hpp` between Release (aka when no problem) and when Debug (aka problems!) > \2. For the case when you have the problem: (that is, when build type is `Debug`, of course) a: ``` $ kshark-su-record QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 19327 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` b: ``` $ sudo kshark-record [sudo] password for user: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 Aborted ``` c: ``` $ pkexec kshark-record QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 Aborted (core dumped) ```
a bit more info: I'm on ArchLinux ``` $ pacman -Qo /usr/include/qt/QtCore/qlist.h /usr/include/qt/QtCore/qlist.h is owned by qt5-base 5.13.0-7 ``` `trace-cmd` used: commit 11d683a8aaabc15a43bd084fb7ddac8d427e2ba4 (HEAD -> master, origin/master, origin/HEAD) Date: Fri Jun 7 12:50:55 2019 +0300
Тhanks! can you post a backtrace of the crash
Do you want me to paste the one from the gist that Comment 2 is pointing to? Or should I paste a completely new one?
I made a new one: ``` Capture process failed: Unknown errorQStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' ASSERT failure in QList::operator[]: "index out of range", file /usr/include/qt/QtCore/qlist.h, line 568 /usr/bin/kshark-su-record: line 8: 30885 Aborted (core dumped) pkexec kshark-record -o ${PWD}/trace.dat ``` ``` [ 3451.171624] pkexec[30885]: pam_unix(polkit-1:session): session opened for user root by (uid=1000) [ 3451.226471] pkexec[30885]: user: Executing command [USER=root] [TTY=unknown] [CWD=/home/user/build/1packages/4used/trace-cmd/packages_pacman] [COMMAND=/usr/bin/kshark-record -o /home/user/build/1packages/4used/trace-cmd/packages_pacman/trace.dat] [ 3451.321533] systemd-coredump[30896]: Process 30885 (kshark-record) of user 0 dumped core. Stack trace of thread 30885: #0 0x000077202d16788d __GI_raise (libc.so.6) #1 0x000077202d14695e __GI_abort (libc.so.6) #2 0x000077202d59c8b6 _ZNK14QMessageLogger5fatalEPKcz (libQt5Core.so.5) #3 0x000077202d59bd3c _Z11qt_assert_xPKcS0_S0_i (libQt5Core.so.5) #4 0x000077202e122625 _ZN5QListIP15QTreeWidgetItemEixEi (libkshark-gui.so.0.9.8) #5 0x000077202e1653ba _ZN16KsCaptureControlC2EP7QWidget (libkshark-gui.so.0.9.8) #6 0x000077202e166aab _ZN15KsCaptureDialogC2EP7QWidget (libkshark-gui.so.0.9.8) #7 0x00005e4c903e5322 main (kshark-record) #8 0x000077202d14829d __libc_start_main (libc.so.6) #9 0x00005e4c903e543e _start (kshark-record) Stack trace of thread 30894: #0 0x000077202d23d238 __GI___poll (libc.so.6) #1 0x000077202bdb880d g_main_context_poll (libglib-2.0.so.0) #2 0x000077202bdb88e0 g_main_context_iteration (libglib-2.0.so.0) #3 0x000077202d7fc9a3 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5) #4 0x000077202d7a35ec _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5) #5 0x000077202d5d62f5 _ZN7QThread4execEv (libQt5Core.so.5) #6 0x0000772028a15b37 n/a (libQt5DBus.so.5) #7 0x000077202d5d7520 n/a (libQt5Core.so.5) #8 0x000077202c87986d start_thread (libpthread.so.0) #9 0x000077202d249d73 __clone (libc.so.6) Stack trace of thread 30893: #0 0x000077202d23d238 __GI___poll (libc.so.6) #1 0x00007720290cf630 n/a (libxcb.so.1) #2 0x00007720290d12db xcb_wait_for_event (libxcb.so.1) #3 0x0000772028b4c049 n/a (libQt5XcbQpa.so.5) #4 0x000077202d5d7520 n/a (libQt5Core.so.5) #5 0x000077202c87986d start_thread (libpthread.so.0) #6 0x000077202d249d73 __clone (libc.so.6) [ 3451.321954] systemd[1]: systemd-coredump@13-30895-0.service: Succeeded. ``` ``` $ sudo coredumpctl -r gdb [sudo] password for user: PID: 30885 (kshark-record) UID: 0 (root) GID: 0 (root) Signal: 6 (ABRT) Timestamp: Mon 2019-07-22 14:44:12 CEST (38s ago) Command Line: /usr/bin/kshark-record -o /home/user/build/1packages/4used/trace-cmd/packages_pacman/trace.dat Executable: /usr/bin/kshark-record Control Group: /user.slice/user-1000.slice/session-1.scope Unit: session-1.scope Slice: user-1000.slice Session: 1 Owner UID: 1000 (user) Boot ID: ac31f666336c40ef9643070804842e00 Machine ID: 5767ef25f523419aaa049f3d74481940 Hostname: i87k Storage: /var/lib/systemd/coredump/core.kshark-record.0.ac31f666336c40ef9643070804842e00.30885.1563799452000000 Message: Process 30885 (kshark-record) of user 0 dumped core. Stack trace of thread 30885: #0 0x000077202d16788d __GI_raise (libc.so.6) #1 0x000077202d14695e __GI_abort (libc.so.6) #2 0x000077202d59c8b6 _ZNK14QMessageLogger5fatalEPKcz (libQt5Core.so.5) #3 0x000077202d59bd3c _Z11qt_assert_xPKcS0_S0_i (libQt5Core.so.5) #4 0x000077202e122625 _ZN5QListIP15QTreeWidgetItemEixEi (libkshark-gui.so.0.9.8) #5 0x000077202e1653ba _ZN16KsCaptureControlC2EP7QWidget (libkshark-gui.so.0.9.8) #6 0x000077202e166aab _ZN15KsCaptureDialogC2EP7QWidget (libkshark-gui.so.0.9.8) #7 0x00005e4c903e5322 main (kshark-record) #8 0x000077202d14829d __libc_start_main (libc.so.6) #9 0x00005e4c903e543e _start (kshark-record) Stack trace of thread 30894: #0 0x000077202d23d238 __GI___poll (libc.so.6) #1 0x000077202bdb880d g_main_context_poll (libglib-2.0.so.0) #2 0x000077202bdb88e0 g_main_context_iteration (libglib-2.0.so.0) #3 0x000077202d7fc9a3 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5) #4 0x000077202d7a35ec _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5) #5 0x000077202d5d62f5 _ZN7QThread4execEv (libQt5Core.so.5) #6 0x0000772028a15b37 n/a (libQt5DBus.so.5) #7 0x000077202d5d7520 n/a (libQt5Core.so.5) #8 0x000077202c87986d start_thread (libpthread.so.0) #9 0x000077202d249d73 __clone (libc.so.6) Stack trace of thread 30893: #0 0x000077202d23d238 __GI___poll (libc.so.6) #1 0x00007720290cf630 n/a (libxcb.so.1) #2 0x00007720290d12db xcb_wait_for_event (libxcb.so.1) #3 0x0000772028b4c049 n/a (libQt5XcbQpa.so.5) #4 0x000077202d5d7520 n/a (libQt5Core.so.5) #5 0x000077202c87986d start_thread (libpthread.so.0) #6 0x000077202d249d73 __clone (libc.so.6) GNU gdb (GDB) 8.3.50.20190719-git Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/bin/kshark-record... [New LWP 30885] [New LWP 30894] [New LWP 30893] [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Core was generated by `/usr/bin/kshark-record -o /home/user/build/1packages/4used/trace-cmd/packages_p'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at /home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50 50 return ret; [Current thread is 1 (Thread 0x772028f79240 (LWP 30885))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at /home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50 #1 0x000077202d14695e in __GI_abort () at abort.c:79 #2 0x000077202d59c8b6 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5 #3 0x000077202d59bd3c in qt_assert_x(char const*, char const*, char const*, int) () from /usr/lib/libQt5Core.so.5 #4 0x000077202e122625 in QList<QTreeWidgetItem*>::operator[] (i=0, this=0x7fffc474f8b0) at /usr/include/qt/QtCore/qstringlist.h:99 #5 KsEventsCheckBoxWidget::removeSystem (this=this@entry=0x7fffc474fc58, name=...) at ../../src/KsWidgetsLib.cpp:753 #6 0x000077202e1653ba in KsCaptureControl::KsCaptureControl (this=0x7fffc474fc20, parent=<optimized out>) at /usr/include/qt/QtCore/qstring.h:699 #7 0x000077202e166aab in KsCaptureDialog::KsCaptureDialog (this=0x7fffc474fbd0, parent=<optimized out>) at /usr/include/qt/QtCore/qflags.h:121 #8 0x00005e4c903e5322 in main (argc=<optimized out>, argv=0x7fffc4750398) at ../../src/kshark-record.cpp:16 (gdb) bt full #0 __GI_raise (sig=sig@entry=6) at /home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50 set = {__val = {0, 8, 103682942063616, 63, 4294967295, 4294967295, 232, 130980083805262, 108, 140736489387712, 140736489387712, 9108452574575613952, 8, 130980080834016, 3, 140736489387912}} pid = <optimized out> tid = <optimized out> ret = <optimized out> #1 0x000077202d14695e in __GI_abort () at abort.c:79 save_stage = 1 act = {__sigaction_handler = {sa_handler = 0x5e4c90ee5400, sa_sigaction = 0x5e4c90ee5400}, sa_mask = {__val = { 9108452574575613952, 130980086576704, 15, 3, 140736489387912, 103682942609360, 140736489389552, 140736489388144, 130980083724069, 0, 9108452574575613952, 140736489387912, 15, 3, 140736489387912, 140736489388144}}, sa_flags = 761065658, sa_restorer = 0x0} sigs = {__val = {32, 0 <repeats 15 times>}} #2 0x000077202d59c8b6 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5 No symbol table info available. #3 0x000077202d59bd3c in qt_assert_x(char const*, char const*, char const*, int) () from /usr/lib/libQt5Core.so.5 No symbol table info available. #4 0x000077202e122625 in QList<QTreeWidgetItem*>::operator[] (i=0, this=0x7fffc474f8b0) at /usr/include/qt/QtCore/qstringlist.h:99 No locals. #5 KsEventsCheckBoxWidget::removeSystem (this=this@entry=0x7fffc474fc58, name=...) at ../../src/KsWidgetsLib.cpp:753 item = <optimized out> index = <optimized out> #6 0x000077202e1653ba in KsCaptureControl::KsCaptureControl (this=0x7fffc474fc20, parent=<optimized out>) at /usr/include/qt/QtCore/qstring.h:699 pluginList = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = { ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x5e4c90fcc660}, d = 0x5e4c90fcc660}}, <No data fields>} row = 0 lamAddLine = {__this = 0x7fffc474fc20} pluginList = <optimized out> row = <optimized out> lamAddLine = <optimized out> message = <optimized out> errorLabel = <optimized out> #7 0x000077202e166aab in KsCaptureDialog::KsCaptureDialog (this=0x7fffc474fbd0, parent=<optimized out>) at /usr/include/qt/QtCore/qflags.h:121 captureExe = <optimized out> #8 0x00005e4c903e5322 in main (argc=<optimized out>, argv=0x7fffc4750398) at ../../src/kshark-record.cpp:16 a = <incomplete type> cd = {<QWidget> = {<No data fields>}, static staticMetaObject = {d = { superdata = 0x77202e0876a0 <QWidget::staticMetaObject>, stringdata = 0x77202e18a900 <qt_meta_stringdata_KsCaptureDialog>, data = 0x77202e18a8c0 <qt_meta_data_KsCaptureDialog>, static_metacall = 0x77202e12dc30 <KsCaptureDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, --Type <RET> for more, q to quit, c to continue without paging--c relatedMetaObjects = 0x0, extradata = 0x0}}, _layout = <incomplete type>, _captureCtrl = {<QWidget> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x77202e0876a0 <QWidget::staticMetaObject>, stringdata = 0x77202e18aac0 <qt_meta_stringdata_KsCaptureControl>, data = 0x77202e18aa60 <qt_meta_data_KsCaptureControl>, static_metacall = 0x77202e12dcf0 <KsCaptureControl::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, _localTEP = 0x0, _eventsWidget = {<KsCheckBoxTreeWidget> = {<KsCheckBoxWidget> = {<QWidget> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x77202e0876a0 <QWidget::staticMetaObject>, stringdata = 0x77202e18a320 <qt_meta_stringdata_KsCheckBoxWidget>, data = 0x77202e18a2e0 <qt_meta_data_KsCheckBoxWidget>, static_metacall = 0x77202e129550 <KsCheckBoxWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, _tb = <incomplete type>, _allCb = <incomplete type>, _id = {d = 0x77202d887640 <QArrayData::shared_null>}, _cbWidget = <incomplete type>, _cbLayout = <incomplete type>, _topLayout = <incomplete type>, _name = {static null = {<No data fields>}, d = 0x5e4c90ee85f0}, _nameLabel = <incomplete type>}, static staticMetaObject = {d = {superdata = 0x77202e1aad40 <KsCheckBoxWidget::staticMetaObject>, stringdata = 0x77202e189f60 <qt_meta_stringdata_KsCheckBoxTreeWidget>, data = 0x77202e189f20 <qt_meta_data_KsCheckBoxTreeWidget>, static_metacall = 0x77202e129540 <KsCheckBoxTreeWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, _tree = {<QTreeWidget> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x77202e0a9080 <QTreeWidget::staticMetaObject>, stringdata = 0x77202e18a000 <qt_meta_stringdata_KsCheckBoxTree>, data = 0x77202e189fa0 <qt_meta_data_KsCheckBoxTree>, static_metacall = 0x77202e1294e0 <KsCheckBoxTree::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, _cb = {d = 0x77202d8875f8}}, <No data fields>}, _topLayout = <incomplete type>, _execLayout = <incomplete type>, _pluginsLabel = <incomplete type>, _outputLabel = <incomplete type>, _commandLabel = <incomplete type>, _outputLineEdit = <incomplete type>, _commandLineEdit = <incomplete type>, _settingsToolBar = <incomplete type>, _controlToolBar = <incomplete type>, _pluginsComboBox = <incomplete type>, _importSettingsButton = <incomplete type>, _exportSettingsButton = <incomplete type>, _outputBrowseButton = <incomplete type>, _lastFilePath = {static null = {<No data fields>}, d = 0x77202d887640 <QArrayData::shared_null>}, _commandCheckBox = <incomplete type>, _captureButton = <incomplete type>, _applyButton = <incomplete type>, _closeButton = <incomplete type>}, _captureMon = {<QWidget> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x77202e0876a0 <QWidget::staticMetaObject>, stringdata = 0x77202e18a9c0 <qt_meta_stringdata_KsCaptureMonitor>, data = 0x77202e18a940 <qt_meta_data_KsCaptureMonitor>, static_metacall = 0x77202e12dd40 <KsCaptureMonitor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, _mergedChannels = false, _argsModified = false, _captureStatus = false, _layout = <incomplete type>, _panel = <incomplete type>, _name = <incomplete type>, _space = <incomplete type>, _readOnlyCB = <incomplete type>, _maxLinNumEdit = <incomplete type>, _consolOutput = <incomplete type>}, _captureProc = <incomplete type>} c = <optimized out> (gdb) frame apply all -q frame #0 __GI_raise (sig=sig@entry=6) at /home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50 50 return ret; #1 0x000077202d14695e in __GI_abort () at abort.c:79 79 raise (SIGABRT); #2 0x000077202d59c8b6 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5 #3 0x000077202d59bd3c in qt_assert_x(char const*, char const*, char const*, int) () from /usr/lib/libQt5Core.so.5 #4 0x000077202e122625 in QList<QTreeWidgetItem*>::operator[] (i=0, this=0x7fffc474f8b0) at /usr/include/qt/QtCore/qstringlist.h:99 99 class QStringList : public QList<QString> #5 KsEventsCheckBoxWidget::removeSystem (this=this@entry=0x7fffc474fc58, name=...) at ../../src/KsWidgetsLib.cpp:753 753 _tree.findItems(name, Qt::MatchFixedString, 0)[0]; #6 0x000077202e1653ba in KsCaptureControl::KsCaptureControl (this=0x7fffc474fc20, parent=<optimized out>) at /usr/include/qt/QtCore/qstring.h:699 699 inline QT_ASCII_CAST_WARN QString(const char *ch) #7 0x000077202e166aab in KsCaptureDialog::KsCaptureDialog (this=0x7fffc474fbd0, parent=<optimized out>) at /usr/include/qt/QtCore/qflags.h:121 121 Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} #8 0x00005e4c903e5322 in main (argc=<optimized out>, argv=0x7fffc4750398) at ../../src/kshark-record.cpp:16 16 KsCaptureDialog cd; (gdb) frame apply all list *$pc #0 __GI_raise (sig=sig@entry=6) at /home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50 0x77202d16788d is in __GI_raise (/home/user/build/1packages/4used/glibc/makepkg_pacman/glibc/src/glibc/sysdeps/unix/sysv/linux/raise.c:50). 45 46 int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig); 47 48 __libc_signal_restore_set (&set); 49 50 return ret; 51 } 52 libc_hidden_def (raise) 53 weak_alias (raise, gsignal) #1 0x000077202d14695e in __GI_abort () at abort.c:79 0x77202d14695e is in __GI_abort (abort.c:81). 76 stage = 0; 77 __libc_lock_unlock_recursive (lock); 78 79 raise (SIGABRT); 80 81 __libc_lock_lock_recursive (lock); 82 stage = save_stage + 1; 83 } 84 85 /* There was a handler installed. Now remove it. */ #2 0x000077202d59c8b6 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5 #3 0x000077202d59bd3c in qt_assert_x(char const*, char const*, char const*, int) () from /usr/lib/libQt5Core.so.5 #4 0x000077202e122625 in QList<QTreeWidgetItem*>::operator[] (i=0, this=0x7fffc474f8b0) at /usr/include/qt/QtCore/qstringlist.h:99 0x77202e122625 is in KsEventsCheckBoxWidget::removeSystem(QString) (/usr/include/qt/QtCore/qstringlist.h:99). 94 inline QStringList *self(); 95 inline const QStringList *self() const; 96 }; 97 98 // ### Qt6: check if there's a better way 99 class QStringList : public QList<QString> 100 { 101 #endif 102 public: 103 inline QStringList() Q_DECL_NOTHROW { } #5 KsEventsCheckBoxWidget::removeSystem (this=this@entry=0x7fffc474fc58, name=...) at ../../src/KsWidgetsLib.cpp:753 0x77202e122625 is in KsEventsCheckBoxWidget::removeSystem(QString) (/usr/include/qt/QtCore/qstringlist.h:99). 94 inline QStringList *self(); 95 inline const QStringList *self() const; 96 }; 97 98 // ### Qt6: check if there's a better way --Type <RET> for more, q to quit, c to continue without paging--c 99 class QStringList : public QList<QString> 100 { 101 #endif 102 public: 103 inline QStringList() Q_DECL_NOTHROW { } #6 0x000077202e1653ba in KsCaptureControl::KsCaptureControl (this=0x7fffc474fc20, parent=<optimized out>) at /usr/include/qt/QtCore/qstring.h:699 0x77202e1653ba is in KsCaptureControl::KsCaptureControl(QWidget*) (/usr/include/c++/9.1.0/bits/atomic_base.h:413). 408 409 __atomic_store_n(&_M_i, __i, int(__m)); 410 } 411 412 _GLIBCXX_ALWAYS_INLINE __int_type 413 load(memory_order __m = memory_order_seq_cst) const noexcept 414 { 415 memory_order __b = __m & __memory_order_mask; 416 __glibcxx_assert(__b != memory_order_release); 417 __glibcxx_assert(__b != memory_order_acq_rel); #7 0x000077202e166aab in KsCaptureDialog::KsCaptureDialog (this=0x7fffc474fbd0, parent=<optimized out>) at /usr/include/qt/QtCore/qflags.h:121 0x77202e166aab is in KsCaptureDialog::KsCaptureDialog(QWidget*) (/usr/include/qt/QtCore/qflags.h:121). 116 #ifdef Q_CLANG_QDOC 117 Q_DECL_CONSTEXPR inline QFlags(const QFlags &other); 118 Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); 119 #endif 120 Q_DECL_CONSTEXPR inline QFlags(Enum flags) Q_DECL_NOTHROW : i(Int(flags)) {} 121 Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} 122 Q_DECL_CONSTEXPR inline QFlags(QFlag flag) Q_DECL_NOTHROW : i(flag) {} 123 124 #ifdef Q_COMPILER_INITIALIZER_LISTS 125 Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) Q_DECL_NOTHROW #8 0x00005e4c903e5322 in main (argc=<optimized out>, argv=0x7fffc4750398) at ../../src/kshark-record.cpp:16 0x5e4c903e5322 is in main(int, char**) (../../src/kshark-record.cpp:16). 11 #include "KsCaptureDialog.hpp" 12 13 int main(int argc, char **argv) 14 { 15 QApplication a(argc, argv); 16 KsCaptureDialog cd; 17 18 int c; 19 while ((c = getopt(argc, argv, "o:")) != -1) { 20 switch(c) { (gdb) ```
Created attachment 283915 [details] crash debugging patch
Please try the attached patch and tell us if it has any effect. also what is the output of the print that is added by the patch? Thanks! Y.
patch seems to work, here's output: ``` $ sudo kshark-record [sudo] password for user: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' tep ptr: 0x0 ``` ``` $ kshark-su-record QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' tep ptr: 0x0 ``` ``` $ pkexec kshark-record QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' tep ptr: 0x0 ```
(In reply to howaboutsynergy from comment #0) > ```sh > #!/bin/bash > > if [ $XDG_SESSION_TYPE = "wayland" ] > > then > xhost +si:localuser:root &>/dev/null > fi > > pkexec kshark-record -o ${PWD}/trace.dat > ``` > > For some reason `$XDG_SESSION_TYPE` can be empty string, thus the "fix" > would be to double-quote it like `"$XDG_SESSION_TYPE"`, ie. > > `if [ "$XDG_SESSION_TYPE" = "wayland" ]` > > I've verified that this doesn't cause the error anymore. Hmm, I fixed this, but some how never pushed the fix up. :-/ I'll apply that change and push, but the other errors you show here are not applicable to this bug. Can you open another BZ that describes the problems you still see after adding the quotes. And then I'll close this BZ after pushing the fix with the quotes. Thanks! -- Steve
to be frank, I'm too lazy to open another BZ _at this time_, but the good news is that Comment 10 already fixed the other errors thanks to Yordan! So maybe closing this bug can signify closing all the errors ? //entering the dream world... laterz
Ideally, we like to document this, but the subject of this BZ doesn't match the bug that we are fixing. I can open another one for you, and just copy the comments there. As for Comment 10, that may be more of a work around. I'd like to know the real cause. Do you have tracefs mounted? $ grep tracefs /proc/mounts -- Steve
Hold down ;) this patch only fixes the symptom (the segfault) but not the real problem. And the real problem is that because of some unknown reason static inline tep_handle *local_events() https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/tree/kernel-shark/src/KsCaptureDialog.cpp#n21 returns NULL on howaboutsynergy's system and it looks that this only happens if you compile with "-g".
Yordan, you should be able to trigger it too by running kshark-record as non-root. I also believe that it doesn't crash without "Debug" because Debug turns off optimization. The Optimization code probably changed the initialization process, and had it detect the problem (no events) as suppose to crashing completely. It was mostly sheer luck that it didn't crash without Debug. That code should expect that tracecmd_get_tracing_dir() and tracecmd_local_events() can both return NULL, and give a warning if they do. -- Steve
> Ideally, we like to document this, but the subject of this BZ doesn't match the bug that we are fixing. I can open another one for you, and just copy the comments there. Hi, I'm back. I can open one, now that I'm a bit refreshed. (will link to it in next comment, assuming no one opened one yet, will search first) > Do you have tracefs mounted? > $ grep tracefs /proc/mounts that shows nothing and exit code is 1 I actually don't have all those CONFIG_* that I should have for trace-cmd to work correctly, those CONFIG_* that I mentioned in https://bugzilla.kernel.org/show_bug.cgi?id=204231#c3 Is it possible that Debug turns on assertions(compared to Release which does not?) and that's why it crashes? > returns NULL on howaboutsynergy's system and it looks that this only happens if you compile with "-g". I think that `BUILD_TYPE=RelWithDebInfo` also compiled with -g but it doesn't crash for me in that case. > Hold down ;) this patch only fixes the symptom (the segfault) but not the real problem. And the real problem is that because of some unknown reason oh right, my bad :)
I made https://bugzilla.kernel.org/show_bug.cgi?id=204277
(In reply to howaboutsynergy from comment #18) > > > returns NULL on howaboutsynergy's system and it looks that this only > happens if you compile with "-g". > > I think that `BUILD_TYPE=RelWithDebInfo` also compiled with -g but it > doesn't crash for me in that case. I doubt its the "-g" that causes the issues but the removal of the optimizations. Debug turns optimizations off, and executes every line of code. With optimizations enabled, gcc does tricks to make the code work faster, by changing the logic which can remove code that ends up not being needed. Which can make the path to the "no events" possible, and not crash on a NULL pointer.
The error in the subject: Unknown error/usr/bin/kshark-su-record: line 3: [: =: unary operator expected is fixed by: 00034f92c6df ("kernel-shark: Add quotes around $XDG_SESSION_TYPE in kshark-su-record") The other error in this report is handled by https://bugzilla.kernel.org/show_bug.cgi?id=204277