epasveer / seer

Seer - a gui frontend to gdb
GNU General Public License v3.0
2.09k stars 66 forks source link

Crash on debugging a segfaulted rr trace #181

Closed tinloaf closed 9 months ago

tinloaf commented 10 months ago

With the recent main, my seergdb crashes when I try to debug a segfault that I recorded via rr. I am using rr version 5.7.0.

Note: I can only reproduce this when debugging an rr trace, not when 'directly' debugging using seergdb. I don't think that this is really dependent on rr, but I suspect the crucial fact is that in rr mode, seergdb already stops once before main() and the 'Locals' tab is populated. If I don't open the 'Locals' tab at this point (see step 5 below), the crash disappears.

Reproduction

I can reproduce it like this:

At this point, my seergbd crashes.

Backtrace

This is the backtrace I see when running the above under gdb:

Thread 1 "seergdb" received signal SIGSEGV, Segmentation fault.
0x00005555556eadcc in qDeleteAll<QList<QTreeWidgetItem*>::const_iterator> (begin=..., end=...)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qalgorithms.h:23
23              delete *begin;
(gdb) bt
#0  0x00005555556eadcc in qDeleteAll<QList<QTreeWidgetItem*>::const_iterator> (begin=..., end=...)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qalgorithms.h:23
#1  0x00005555556eabef in qDeleteAll<QList<QTreeWidgetItem*> > (c=...) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qalgorithms.h:31
#2  0x000055555581568f in SeerStackLocalsBrowserWidget::handleText (this=0x555555d5bad0, text=...)
    at ~/src/seer/src/SeerStackLocalsBrowserWidget.cpp:89
#3  0x00005555557a05ff in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QString const&>, void, void (SeerStackLocalsBrowserWidget::*)(QString const&)>::call (
    f=(void (SeerStackLocalsBrowserWidget::*)(SeerStackLocalsBrowserWidget * const, const QString &)) 0x55555581511a <SeerStackLocalsBrowserWidget::handleText(QString const&)>, o=0x555555d5bad0, arg=0x7fffffffd0e0) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:135
#4  0x000055555579ecbd in QtPrivate::FunctionPointer<void (SeerStackLocalsBrowserWidget::*)(QString const&)>::call<QtPrivate::List<QString const&>, void> (
    f=(void (SeerStackLocalsBrowserWidget::*)(SeerStackLocalsBrowserWidget * const, const QString &)) 0x55555581511a <SeerStackLocalsBrowserWidget::handleText(QString const&)>, o=0x555555d5bad0, arg=0x7fffffffd0e0) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:172
#5  0x000055555579b8df in QtPrivate::QSlotObject<void (SeerStackLocalsBrowserWidget::*)(QString const&), QtPrivate::List<QString const&>, void>::impl
    (which=1, this_=0x555555d9e370, r=0x555555d5bad0, a=0x7fffffffd0e0, ret=0x0) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:383
#6  0x00007ffff6b11326 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#7  0x00005555556a2830 in GdbMonitor::caretTextOutput (this=0x555555b53b70, _t1=...)
    at ~/src/seer/src/build/seergdb_autogen/EWIEGA46WW/moc_GdbMonitor.cpp:371
#8  0x00005555556d1c50 in GdbMonitor::handleReadyReadStandardOutput (this=0x555555b53b70) at ~/src/seer/src/GdbMonitor.cpp:98
#9  0x000055555579fcb6 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (GdbMonitor::*)()>::call(void (GdbMonitor::*)(), GdbMonitor*, void**) (f=(void (GdbMonitor::*)(GdbMonitor * const)) 0x5555556d18f0 <GdbMonitor::handleReadyReadStandardOutput()>,
    o=0x555555b53b70, arg=0x7fffffffd370) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:135
#10 0x000055555579e951 in QtPrivate::FunctionPointer<void (GdbMonitor::*)()>::call<QtPrivate::List<>, void>(void (GdbMonitor::*)(), GdbMonitor*, void**) (f=(void (GdbMonitor::*)(GdbMonitor * const)) 0x5555556d18f0 <GdbMonitor::handleReadyReadStandardOutput()>, o=0x555555b53b70, arg=0x7fffffffd370)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:172
#11 0x000055555579ad57 in QtPrivate::QSlotObject<void (GdbMonitor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x555555b6b640, r=0x555555b53b70, a=0x7fffffffd370, ret=0x0)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:383
#12 0x00007ffff6b11326 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#13 0x00007ffff6c4e021 in QProcess::readyReadStandardOutput(QProcess::QPrivateSignal) () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#14 0x00007ffff6c4e2dd in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#15 0x00007ffff6c51515 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#16 0x00007ffff6b116d3 in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#17 0x00007ffff6b155d3 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) ()
   from /lib/x86_64-linux-gnu/libQt6Core.so.6
#18 0x00007ffff6b17bd3 in QSocketNotifier::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#19 0x00007ffff775daab in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#20 0x00007ffff6ac6858 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#21 0x00007ffff6cbc58f in ?? () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#22 0x00007ffff60e749d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff6142178 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff60e61b0 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff6cb3f20 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#26 0x00007ffff6ad09aa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#27 0x00007ffff6ac971c in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt6Core.so.6
#28 0x00005555556cd226 in main (argc=3, argv=0x7fffffffdf48) at ~/src/seer/src/seergdb.cpp:338
epasveer commented 10 months ago

Thanks for the detailed problem report. I should be able to reproduce it using your directions.

epasveer commented 9 months ago

I wasn't able to duplicate it with your instructions. However, the traceback pointed me to the error in my code.

I've fixed it in the mainline.

tinloaf commented 9 months ago

The crash is gone, thanks a lot!