Bug 330732

Summary: KCachegrind crashes while try to show <cycle> function
Product: [Developer tools] kcachegrind Reporter: Artyom Petrenkov <static.lab>
Component: generalAssignee: Josef Weidendorfer <josef.weidendorfer>
Status: RESOLVED FIXED    
Severity: crash Keywords: drkonqi
Priority: NOR    
Version: 0.7.4kde   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.12.3
Sentry Crash Report:

Description Artyom Petrenkov 2014-02-04 07:00:50 UTC
Application: kcachegrind (0.7.4kde)
KDE Platform Version: 4.12.1
Qt Version: 4.8.6
Operating System: Linux 3.11.0-15-generic i686
Distribution: Ubuntu 13.10

-- Information about the crash:
- What I was doing when the application crashed:

Double click to any <cycle> function. KCachegrind always crashes.

The crash can be reproduced every time.

-- Backtrace:
Application: KCachegrind (kcachegrind), signal: Floating point exception
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0xb4f30740 (LWP 10545))]

Thread 2 (Thread 0xb2328b40 (LWP 10546)):
#0  0xb774b424 in __kernel_vsyscall ()
#1  0xb5dc74d2 in clock_gettime (clock_id=1, tp=0xb2327fc8) at ../sysdeps/unix/clock_gettime.c:115
#2  0xb60818bc in do_gettime (frac=0xb2327fc0, sec=0xb2327fb8) at tools/qelapsedtimer_unix.cpp:127
#3  qt_gettime () at tools/qelapsedtimer_unix.cpp:144
#4  0xb616a242 in updateCurrentTime (this=0xb1a02074) at kernel/qeventdispatcher_unix.cpp:354
#5  QTimerInfoList::timerWait (this=0xb1a02074, tm=...) at kernel/qeventdispatcher_unix.cpp:460
#6  0xb616881b in timerSourcePrepareHelper (src=<optimized out>, timeout=0xb23280bc) at kernel/qeventdispatcher_glib.cpp:136
#7  0xb61688ad in timerSourcePrepare (source=0xb1a02040, timeout=0xb23280bc) at kernel/qeventdispatcher_glib.cpp:169
#8  0xb54f5143 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0
#9  0xb54f5a5f in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#10 0xb54f5ca8 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#11 0xb61689ef in QEventDispatcherGlib::processEvents (this=0xb1a00468, flags=...) at kernel/qeventdispatcher_glib.cpp:427
#12 0xb6137813 in QEventLoop::processEvents (this=this@entry=0xb2328228, flags=...) at kernel/qeventloop.cpp:149
#13 0xb6137b39 in QEventLoop::exec (this=this@entry=0xb2328228, flags=...) at kernel/qeventloop.cpp:204
#14 0xb602421d in QThread::exec (this=this@entry=0x8c613c8) at thread/qthread.cpp:537
#15 0xb6117c34 in QInotifyFileSystemWatcherEngine::run (this=0x8c613c8) at io/qfilesystemwatcher_inotify.cpp:265
#16 0xb6026b4f in QThreadPrivate::start (arg=0x8c613c8) at thread/qthread_unix.cpp:349
#17 0xb55d4d78 in start_thread (arg=0xb2328b40) at pthread_create.c:311
#18 0xb5db401e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:131

Thread 1 (Thread 0xb4f30740 (LWP 10545)):
[KCrash Handler]
#7  0xb5e7e064 in __udivmoddi4 (rp=0x0, d=0, n=791) at ../../../src/libgcc/libgcc2.c:933
#8  __udivdi3 (n=791, d=0) at ../../../src/libgcc/libgcc2.c:1178
#9  0x08075d46 in ProfileCostArray::prettySubCostPerCall (this=0x909ab68, t=0x8a77028, calls=0) at ../../libcore/costitem.cpp:608
#10 0x080e56b4 in CallItem::updateCost (this=this@entry=0x93d2388) at ../../libviews/callitem.cpp:119
#11 0x080e5bcd in CallItem::CallItem (this=0x93d2388, view=0x8c8e750, parent=0x0, c=0x909ab68) at ../../libviews/callitem.cpp:61
#12 0x080dfd7f in CallView::refresh (this=0x8c8e750) at ../../libviews/callview.cpp:283
#13 0x080acb68 in TraceItemView::triggerUpdate (this=0x8c8e764, force=false) at ../../libviews/traceitemview.cpp:309
#14 0xb614e0e7 in QMetaObject::activate (sender=sender@entry=0x8c954a0, m=0x8119278 <QTimer::staticMetaObject>, m@entry=0xb62a4518 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3539
#15 0xb619e3a5 in QTimer::timeout (this=this@entry=0x8c954a0) at .moc/release-shared/moc_qtimer.cpp:147
#16 0xb6157916 in QTimer::timerEvent (this=0x8c954a0, e=0xbfcc5cf0) at kernel/qtimer.cpp:280
#17 0xb615254c in QObject::event (this=0x8c954a0, e=0xbfcc5cf0) at kernel/qobject.cpp:1156
#18 0xb67107f4 in QApplicationPrivate::notify_helper (this=0x8a0c328, receiver=0x8c954a0, e=0xbfcc5cf0) at kernel/qapplication.cpp:4567
#19 0xb67172d3 in QApplication::notify (this=0xbfcc5fc4, receiver=receiver@entry=0x8c954a0, e=e@entry=0xbfcc5cf0) at kernel/qapplication.cpp:4353
#20 0xb7261164 in KApplication::notify (this=0xbfcc5fc4, receiver=0x8c954a0, event=0xbfcc5cf0) at ../../kdeui/kernel/kapplication.cpp:311
#21 0xb6138e3a in QCoreApplication::notifyInternal (this=0xbfcc5fc4, receiver=0x8c954a0, event=event@entry=0xbfcc5cf0) at kernel/qcoreapplication.cpp:953
#22 0xb616b75b in sendEvent (event=0xbfcc5cf0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#23 QTimerInfoList::activateTimers (this=this@entry=0x8a04fe4) at kernel/qeventdispatcher_unix.cpp:621
#24 0xb6168778 in timerSourceDispatch (source=0x8a04fb0) at kernel/qeventdispatcher_glib.cpp:186
#25 0xb54f583e in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#26 0xb54f5be8 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#27 0xb54f5ca8 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#28 0xb61689cf in QEventDispatcherGlib::processEvents (this=this@entry=0x89eef20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#29 0xb67c55fe in QGuiEventDispatcherGlib::processEvents (this=0x89eef20, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#30 0xb6137813 in QEventLoop::processEvents (this=this@entry=0xbfcc5f18, flags=...) at kernel/qeventloop.cpp:149
#31 0xb6137b39 in QEventLoop::exec (this=this@entry=0xbfcc5f18, flags=...) at kernel/qeventloop.cpp:204
#32 0xb613d8ee in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#33 0xb670ea24 in QApplication::exec () at kernel/qapplication.cpp:3828
#34 0x0805edd2 in main (argc=3, argv=0xbfcc6094) at ../../kcachegrind/main.cpp:91

Reported using DrKonqi
Comment 1 Josef Weidendorfer 2014-02-04 09:43:45 UTC
Git commit 689893989f783b7619695a37a7a7331202179269 by Josef Weidendorfer.
Committed on 06/01/2014 at 02:06.
Pushed by weidendo into branch 'KDE/4.12'.

Fix: Do not crash on functions with call count 0.

Cherry-picked from master.

Call count 0 may exist with Callgrind when measuring starts after
the function was called but when the function is still active,
ie. not returned yet. For "cost per call", it makes sense to show
the full cost while the function was active.

M  +8    -0    libcore/costitem.cpp

http://commits.kde.org/kcachegrind/689893989f783b7619695a37a7a7331202179269
Comment 2 Josef Weidendorfer 2014-02-04 09:47:14 UTC
Thanks for the report.

There was a fix for some bug introduced with a recently added feature that did not make
it into 4.12 branch.