Here is the second try to have stacktrace support in Pulseview complete.

Changes since v1:
* HACK crashes now when you press "Run" in pv, so you can view logs
  before
* added check if 'backtrace' is supported on the system
* depending on that, the backtrace tracer or the simple tracer is used
* no hardcoded libs anymore, all replaced by variables
* enforcing the debug build was removed. Also, no warning yet when you
  enable stacktrace and have no debug symbols

For symbols outside pv, you still need to disable ASLR with

$ sudo sysctl -w kernel.randomize_va_space=0

or using 'setarch ... -R ...'

If you do that, the backtrace tracer gives nice output:

pv: Stack trace file is "/tmp/pv_stacktrace.dmp"
pv: "Stack trace of previous crash:"
pv: ---------------------------------------------------------
pv: 0# signal_handler(int) at /home/ninja/Tools/sigrok/pulseview/main.cpp:88
1# 0x00007FFFF63A38E0 in /lib/x86_64-linux-gnu/libc.so.6
2# raise at ../sysdeps/unix/sysv/linux/raise.c:51
3# signal_handler(int) at /home/ninja/Tools/sigrok/pulseview/main.cpp:90
4# 0x00007FFFF63A38E0 in /lib/x86_64-linux-gnu/libc.so.6
5# pv::MainWindow::on_run_stop_clicked() at 
/home/ninja/Tools/sigrok/pulseview/pv/mainwindow.cpp:713
6# pv::MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) 
at 
/home/ninja/Tools/sigrok/pulseview/pulseview_autogen/PLNN4COFE5/moc_mainwindow.cpp:156
7# QMetaObject::activate(QObject*, int, int, void**) at kernel/qobject.cpp:3788
8# QAbstractButton::clicked(bool) at .moc/moc_qabstractbutton.cpp:309
9# QAbstractButtonPrivate::emitClicked() at widgets/qabstractbutton.cpp:416
10# QAbstractButtonPrivate::click() at widgets/qabstractbutton.cpp:395
11# QAbstractButton::mouseReleaseEvent(QMouseEvent*) at 
widgets/qabstractbutton.cpp:1012
12# QToolButton::mouseReleaseEvent(QMouseEvent*) at widgets/qtoolbutton.cpp:623
13# QWidget::event(QEvent*) at kernel/qwidget.cpp:9355
14# QToolButton::event(QEvent*) at widgets/qtoolbutton.cpp:986
15# QApplicationPrivate::notify_helper(QObject*, QEvent*) at 
kernel/qapplication.cpp:3728
16# QApplication::notify(QObject*, QEvent*) at kernel/qapplication.cpp:3203
17# Application::notify(QObject*, QEvent*) at 
/home/ninja/Tools/sigrok/pulseview/pv/application.cpp:318
18# QCoreApplication::notifyInternal2(QObject*, QEvent*) at 
kernel/qcoreapplication.cpp:1047
19# QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, 
QWidget*, QWidget**, QPointer&, bool) at kernel/qapplication.cpp:2697
20# QWidgetWindow::handleMouseEvent(QMouseEvent*) at 
../../include/QtCore/../../src/corelib/kernel/qcoreevent.h:304
21# QWidgetWindow::event(QEvent*) at kernel/qwidgetwindow.cpp:224
22# QApplicationPrivate::notify_helper(QObject*, QEvent*) at 
kernel/qapplication.cpp:3728
23# QApplication::notify(QObject*, QEvent*) at kernel/qapplication.cpp:3486
24# Application::notify(QObject*, QEvent*) at 
/home/ninja/Tools/sigrok/pulseview/pv/application.cpp:318
25# QCoreApplication::notifyInternal2(QObject*, QEvent*) at 
kernel/qcoreapplication.cpp:1047
26# 
QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*)
 at kernel/qguiapplication.cpp:2083
27# 
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
 at kernel/qguiapplication.cpp:1818
28# QWindowSystemInterface::sendWindowSystemEvents(QFlags) at 
kernel/qwindowsysteminterface.cpp:1032
29# QPAEventDispatcherGlib::processEvents(QFlags) at 
./src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp:71
30# QEventLoop::exec(QFlags) at kernel/qeventloop.cpp:213
31# QCoreApplication::exec() at kernel/qcoreapplication.cpp:1335
32# main at /home/ninja/Tools/sigrok/pulseview/main.cpp:335
33# __libc_start_main at ../csu/libc-start.c:342
34# 0x00000000004AABDA in ./pulseview
pv: ---------------------------------------------------------

Simple tracer still works, too. Again no testing on non-Linux platforms.

Thanks to Soeren, Gerhard, and Uwe for support!

Looking forward to comments.


Wolfram Sang (2):
  HACK: make pulseview crash when pressing "Run"
  Add stacktrace support

 CMakeLists.txt    | 17 ++++++++++++++---
 pv/mainwindow.cpp |  1 +
 2 files changed, 15 insertions(+), 3 deletions(-)

-- 
2.20.1



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to