Bug 95667 - Valgrind does not work with any KDE app
Summary: Valgrind does not work with any KDE app
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-22 14:45 UTC by Thomas McGuire
Modified: 2005-01-22 01:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas McGuire 2004-12-22 14:45:08 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

When I use valgrind with a normal application (ls, enigma,xmag,...) all works fine.
However, with all KDE applications, the app run by valgrind crashes soon after start.

tmg@PC1:~> valgrind --tool=cachegrind konsole
==1913== Cachegrind, an I1/D1/L2 cache profiler for x86-linux.
==1913== Copyright (C) 2002-2004, and GNU GPL'd, by Nicholas Nethercote et al.
==1913== Using valgrind-2.3.0.CVS, a program supervision framework for x86-linux.
==1913== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==1913== For more details, rerun with: -v
==1913==
==1913==
==1913== Process terminating with default action of signal 11 (SIGSEGV)
==1913==  Access not within mapped region at address 0x0
==1913==    at 0x3C0CE780: _IO_vfscanf_internal (in /lib/i686/libc.so.6)
==1913==    by 0x3C0DD6F0: _IO_vsscanf (in /lib/i686/libc.so.6)
==1913==    by 0x3C0D8BFA: _IO_sscanf (in /lib/i686/libc.so.6)
==1913==    by 0x3BCD0427: (within /usr/lib/libGL.so.1.0.6106)
==1913==
==1913== I   refs:      73,100,611
==1913== I1  misses:         1,690
==1913== L2i misses:         1,649
==1913== I1  miss rate:        0.0%
==1913== L2i miss rate:        0.0%
==1913==
==1913== D   refs:      32,466,032  (26,374,696 rd + 6,091,336 wr)
==1913== D1  misses:     1,770,471  ( 1,765,895 rd +     4,576 wr)
==1913== L2d misses:     1,169,799  ( 1,166,480 rd +     3,319 wr)
==1913== D1  miss rate:        5.4% (       6.6%   +       0.0%  )
==1913== L2d miss rate:        3.6% (       4.4%   +       0.0%  )
==1913==
==1913== L2 refs:        1,772,161  ( 1,767,585 rd +     4,576 wr)
==1913== L2 misses:      1,171,448  ( 1,168,129 rd +     3,319 wr)
==1913== L2 miss rate:         1.1% (       1.1%   +       0.0%  )
Segmentation fault

I am using KDE CVS on SuSE 9.0 Professional, compiled with gcc version 3.3.1 (SuSE Linux).
I hope this is not an invalid bug report, since I do not know much about valgrind.
Comment 1 Tom Hughes 2005-01-02 13:34:32 UTC
Does this happen with all tools? or only with cachegrind?

Can you try with --num-callers=24 so that we get more of a backtrace?
Comment 2 Thomas McGuire 2005-01-04 16:06:30 UTC
>Does this happen with all tools? or only with cachegrind?
It happens with all tools, and only with KDE apps.

>Can you try with --num-callers=24 so that we get more of a backtrace?
Does not seem to change anything...

tmg@PC1:~> valgrind --tool=none --num-callers=24 kdf
==1495== Nulgrind, a binary JIT-compiler for x86-linux.
==1495== Copyright (C) 2002-2004, and GNU GPL'd, by Nicholas Nethercote.
==1495== Using valgrind-2.3.0.CVS, a program supervision framework for x86-linux.
==1495== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==1495== For more details, rerun with: -v
==1495==
==1495==
==1495== Process terminating with default action of signal 11 (SIGSEGV)
==1495==  Access not within mapped region at address 0x0
==1495==    at 0x3BEF9780: _IO_vfscanf_internal (in /lib/i686/libc.so.6)
==1495==    by 0x3BF086F0: _IO_vsscanf (in /lib/i686/libc.so.6)
==1495==    by 0x3BF03BFA: _IO_sscanf (in /lib/i686/libc.so.6)
==1495==    by 0x3BB0E177: (within /usr/lib/libGL.so.1.0.6629)
==1495==
Segmentation fault

The bug seems to be in /usr/lib/libGL.so.1.0.6629, which perhaps indicates a problem with my NVIDIA drivers, which are version 6629 (Kernel 2.6.9). I wonder why all KDE apps are linked to OpenGL...

Indeed only OpenGL apps seem to crash, as 
tmg@PC1:~> valgrind --tool=none glxgears
confirms.

Anything else I can do?
Comment 3 Tom Hughes 2005-01-04 16:33:25 UTC
I understand now - this is just the usual OpenGL problem caused by the code trying to test for SSE support in a really horrible way. Unfortunately it fails because valgrind doesn't provide the FPU state in the signal context when a floating point exception occurs.

See bug 86641 for much more discussion of this, and bug 74298 for the underlying problems regarding FPU state in signal handlers.

*** This bug has been marked as a duplicate of 74298 ***
Comment 4 Tom Hughes 2005-01-04 16:36:52 UTC
Actually, scratch that comment. Your stack trace is all wrong for it to be that. In fact it's in a really odd place - the OpenGL drive is obviously trying to read from a file something but is presumably giving a bogus pointer to the input code or something.
Comment 5 Tom Hughes 2005-01-04 16:40:09 UTC
I just tried glxgears on a Fedora Core 3 box with the NVidia 6629 drivers and it works fine there...
Comment 6 Thiago Macieira 2005-01-04 16:45:51 UTC
No crash here either.

KDE HEAD 20041209
libGL and NVidia drivers 6629
X.org X11 R6.8

$ valgrind --version
valgrind-2.2.0
Comment 7 Jeremy Fitzhardinge 2005-01-05 00:26:46 UTC
Looks like it might be a TLS problem to me.  It would be interesting to know what the actual faulting instruction is.
Comment 8 Jeremy Fitzhardinge 2005-01-18 23:46:20 UTC
Could you build from CVS head and try again?
Comment 9 Thomas McGuire 2005-01-20 16:00:08 UTC
On Tuesday 18 January 2005 22:46, Jeremy Fitzhardinge wrote:
> Could you build from CVS head and try again?
Sorry, I am currently having problems with my build:

> make[4]: Entering directory `/home/tmg/src/kde/valgrind/coregrind'
> make[4]: *** No rule to make target `vg_proxylwp.c', needed by 
`stage2-vg_proxylwp.o'.  Stop.
This seems to be a Makefile problem, but I do not know how to resolve it. 
With normal KDE apps, make -f Makefile.cvs && configure normally resolves 
these problems, but valgrind has no Makefile.cvs.

What should I do to get valgrind built ?
Sorry to bother you with this, but I really don't know what to do.

Comment 10 Tom Hughes 2005-01-20 16:09:43 UTC
That file no longer exists so the makefile shouldn't be trying to build it. I suspect you need to rerun autogen.sh to update your makefiles.
Comment 11 Thomas McGuire 2005-01-20 21:54:41 UTC
On Thursday 20 January 2005 15:09, Tom Hughes wrote:
> That file no longer exists so the makefile shouldn't be trying to build
> it. I suspect you need to rerun autogen.sh to update your makefiles.

Did not work.
> tmg@PC1:~/src/kde/valgrind> sh autogen.sh
> running: aclocal
> running: autoheader
> configure.in:2: error: Autoconf version 2.59 or higher is required
> configure.in:2: the top level
> autom4te: /usr/bin/m4 failed with exit status: 1
> autoheader: /usr/bin/autom4te failed with exit status: 1
> error: while running 'autoheader'

Don't tell me to update autoconf/automake. It simply does not work, I 
tried already. All sorts of weird stuff happens then, I guess my distro 
(SuSE 9.0) is too much out of date to handle newer versions.

I also tried export WANT_AUTOCONF=2.57 and export WANT_AUTOMAKE=1.7, but 
that did not work, too.

Anything else I can try? If not, this bugreport should probably be closed 
as I can not test the fix.

Words can not describe how much I hate the autotools.

Comment 12 Tom Hughes 2005-01-21 01:18:16 UTC
I've sent a CVS snapshot with autogen.sh already run so Thomas can try that.
Comment 13 Thomas McGuire 2005-01-21 20:29:22 UTC
On Friday 21 January 2005 00:18, Tom Hughes wrote:
> I've sent a CVS snapshot with autogen.sh already run so Thomas can try
> that.
I've built the snapshot and valgrind now works without problems for all 
apps.

Thanks for the snapshot and for fixing the bug!

Comment 14 Tom Hughes 2005-01-22 01:08:15 UTC
Thanks for confirming that.