how to locate glibc errors

hi,

In my application, I load a mesh and a scalar function, and do some processing on it. When all that processing is done, I use QGLViewer to display the mesh.
I tried to use valgrind as well as some printf-type debuging. This is the output of the printf-type run.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
./Jacobi
NVIDIA: could not open the device file /dev/nvidiactl (Permission denied).

Reading plane_40.off... 
  Reading 1600 vertices... 
  Reading 3042 faces... Done.
Computing bounding box... Done.
  x = -1 .. 1, y = -1 .. 1, z = 0 .. 0
Computing normals... Done.
Finding vertex to triangle maps... Done.
Finding across-edge maps... Done.
Building triangle strips... Done.
  39 strips (Avg. length 78.0)
Finding vertex neighbors... Done.
Computing edges... Done.
Orienting the components CCW...Done!
Generating function f... Done.
Generating function g... Done.
SoS: matrix[1600,2] @ 5 Lia digits; lia_length (10); 0.147 Mb.
 Identified 26 Critical Points!
 Identified 5 Critical Points!
Computing Jacobi Set... ------ using SOS ------ Done. Identified 295 Jacobi Edges.
Unfolding Jacobi Sets... (I found 32 folded vertices) Done!
Creating JE Components...  Done! No of components = 32
Computing BD points... Done! BD.size() = 109
 drawing ...
 done
 drawing ...
 done
 drawing ...
 done
*** glibc detected *** ./Jacobi: realloc(): invalid old size: 0x0000000000b37130 ***


Note that,

1) Sometimes, I dont get this error and program runs fine. (after all this processing, I can view the mesh)
2) When I try to unvalgrind on this using
valgrind --tool=memcheck --leak-check=yes ./Jacobi, it runs just fine. Doesnt get this error.
3) Everytime I get this error, I get the same address.

I am having trouble and narrowing down to the code which throws this error, since once the preprocessing is done, all the program should do is display as an idle callback.

Also, I DO NOT use realloc in my code at all. However, I have this feeling that this error is through the QGLViewer. Any ideas on how to debug this ?

Thanks
Last edited on
This is the stack when I interrupt the debugger after getting the aforementioned error.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
0	__lll_lock_wait_private	/lib64/libc.so.6	0	0x7ffff55b473e	
1	_L_lock_9946	/lib64/libc.so.6	0	0x7ffff5548d21	
2	malloc	/lib64/libc.so.6	0	0x7ffff5546d60	
3	_dl_map_object_deps	/lib64/ld-linux-x86-64.so.2	0	0x7ffff7de84a9	
4	dl_open_worker	/lib64/ld-linux-x86-64.so.2	0	0x7ffff7dedc88	
5	_dl_catch_error	/lib64/ld-linux-x86-64.so.2	0	0x7ffff7de9c36	
6	_dl_open	/lib64/ld-linux-x86-64.so.2	0	0x7ffff7ded7ca	
7	do_dlopen	/lib64/libc.so.6	0	0x7ffff55de840	
8	_dl_catch_error	/lib64/ld-linux-x86-64.so.2	0	0x7ffff7de9c36	
9	dlerror_run	/lib64/libc.so.6	0	0x7ffff55de8df	
10	__libc_dlopen_mode	/lib64/libc.so.6	0	0x7ffff55de947	
11	init	/lib64/libc.so.6	0	0x7ffff55b9d15	
12	pthread_once	/lib64/libpthread.so.0	0	0x7ffff65653d3	
13	backtrace	/lib64/libc.so.6	0	0x7ffff55b9e34	
14	__libc_message	/lib64/libc.so.6	0	0x7ffff553cedf	
15	malloc_printerr	/lib64/libc.so.6	0	0x7ffff5542c06	
16	_int_realloc	/lib64/libc.so.6	0	0x7ffff5545977	
17	realloc	/lib64/libc.so.6	0	0x7ffff55473be	
18	ft_mem_qrealloc	/usr/lib64/libfreetype.so.6	0	0x7ffff52568a2	
19	ft_mem_realloc	/usr/lib64/libfreetype.so.6	0	0x7ffff525695b	
20	FT_GlyphLoader_CheckPoints	/usr/lib64/libfreetype.so.6	0	0x7ffff5256b17	
21	??	/usr/lib64/libfreetype.so.6	0	0x7ffff5262daf	
22	??	/usr/lib64/libfreetype.so.6	0	0x7ffff5267329	
23	??	/usr/lib64/libfreetype.so.6	0	0x7ffff526c911	
24	FT_Load_Glyph	/usr/lib64/libfreetype.so.6	0	0x7ffff5259164	
25	QFontEngineFT::loadGlyph(QFontEngineFT::QGlyphSet*, unsigned int, QFontEngineFT::GlyphFormat, bool) const	/usr/lib64/libQtGui.so.4	0	0x7ffff70bb4c6	
26	QFontEngineFT::recalcAdvances(QGlyphLayout*, QFlags<QTextEngine::ShaperFlag>) const	/usr/lib64/libQtGui.so.4	0	0x7ffff70bd038	
27	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6ff0bf8	
28	??	/usr/lib64/libQtCore.so.4	0	0x7ffff6857163	
29	??	/usr/lib64/libQtCore.so.4	0	0x7ffff685b504	
30	QTextEngine::shapeTextWithHarfbuzz(int) const	/usr/lib64/libQtGui.so.4	0	0x7ffff7020d64	
31	QTextEngine::shapeText(int) const	/usr/lib64/libQtGui.so.4	0	0x7ffff70215cb	
32	QTextEngine::shape(int) const	/usr/lib64/libQtGui.so.4	0	0x7ffff70218e8	
33	QTextLine::layout_helper(int)	/usr/lib64/libQtGui.so.4	0	0x7ffff702b3a0	
34	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6f2691c	
35	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6f27221	
36	QFontMetrics::boundingRect(QRect const&, int, QString const&, int, int*) const	/usr/lib64/libQtGui.so.4	0	0x7ffff6ffe80f	
37	QFontMetrics::size(int, QString const&, int, int*) const	/usr/lib64/libQtGui.so.4	0	0x7ffff6ffe88f	
38	??	/usr/lib64/kde4/plugins/styles/oxygen.so	0	0x7fffeaddbd3e	
39	??	/usr/lib64/kde4/plugins/styles/oxygen.so	0	0x7fffeaddc11b	
40	QCommonStyle::drawComplexControl(QStyle::ComplexControl, QStyleOptionComplex const*, QPainter*, QWidget const*) const	/usr/lib64/libQtGui.so.4	0	0x7ffff70e5ffc	
41	??	/usr/lib64/kde4/plugins/styles/oxygen.so	0	0x7fffeadcb72b	
42	QGroupBox::paintEvent(QPaintEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff71ce05b	
43	QWidget::event(QEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e292b8	
44	QGroupBox::event(QEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff71cef17	
45	QApplicationPrivate::notify_helper(QObject*, QEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6dd8c34	
46	QApplication::notify(QObject*, QEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6dddac1	
47	QCoreApplication::notifyInternal(QObject*, QEvent*)	/usr/lib64/libQtCore.so.4	0	0x7ffff68d681c	
48	QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e261c6	
49	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26da0	
50	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26c80	
51	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26c80	
52	QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e25efc	
53	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26da0	
54	QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e25efc	
55	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26da0	
56	QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e26c80	
57	QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e25efc	
58	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6fe5278	
59	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6fe5605	
60	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6e53d6a	
61	QApplication::x11ProcessEvent(_XEvent*)	/usr/lib64/libQtGui.so.4	0	0x7ffff6e54dc9	
62	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6e7c312	
63	g_main_context_dispatch	/usr/lib64/libglib-2.0.so.0	0	0x7ffff484158d	
64	??	/usr/lib64/libglib-2.0.so.0	0	0x7ffff4841d88	
65	g_main_context_iteration	/usr/lib64/libglib-2.0.so.0	0	0x7ffff4841f59	
66	QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/lib64/libQtCore.so.4	0	0x7ffff690150f	
67	??	/usr/lib64/libQtGui.so.4	0	0x7ffff6e7bf9e	
68	QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/lib64/libQtCore.so.4	0	0x7ffff68d5a22	
69	QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/lib64/libQtCore.so.4	0	0x7ffff68d5c1f	
70	QCoreApplication::exec()	/usr/lib64/libQtCore.so.4	0	0x7ffff68d9de7	
71	main	main.cc	17	0x446824	
Topic archived. No new replies allowed.