blob: ec3be4638df2c6d3a41f9b0ebd119278e9468665 [file] [log] [blame]
sewardjde4a1d02002-03-22 01:27:54 +00001
sewardj40183922002-06-19 20:52:32 +0000219 June 2002
sewardjde4a1d02002-03-22 01:27:54 +00003
4The purpose of this small doc is to guide you in using Valgrind to
5find and fix memory management bugs in KDE3.
6
7 ---------------------------------------------------
8
9Here's a getting-started-quickly checklist. It might sound daunting,
10but once set up things work fairly well.
11
12
sewardj365a8512002-07-01 08:30:05 +000013* You need an x86 box running a Linux 2.2 or 2.4 kernel, with glibc
14 2.1.X or 2.2.X and XFree86 3.X or 4.X. In practice this means
15 practically any recent Linux distro. Valgrind is developed on a
16 vanilla Red Hat 7.2 installation, so at least works ok there.
17 I imagine Mandrake 8 and SuSE 7.X would be ok too. It is known to
18 work on Red Hats 6.2, 7.2 and 7.3, at the very least.
sewardjde4a1d02002-03-22 01:27:54 +000019
20
21* You need a reasonably fast machine, since programs run 25-100 x
sewardj365a8512002-07-01 08:30:05 +000022 slower on Valgrind. I work with a 1133 MHz PIII with 512 M of
23 memory. Interactive programs like kate, konqueror, etc, are
24 usable, but in all, the faster your machine, the more useful
25 valgrind will be.
sewardjde4a1d02002-03-22 01:27:54 +000026
27
28* You need at least 256M of memory for reasonable behaviour. Valgrind
sewardj365a8512002-07-01 08:30:05 +000029 inflates the memory use of KDE apps approximately 3-4 x, so (eg)
30 konqueror needs ~ 140M of memory to get started, although to be fair,
31 at least 40 M of that is due to reading the debug info -- this is for
32 a konqueror and all libraries built with -O -g.
sewardjde4a1d02002-03-22 01:27:54 +000033
34
35* You need to compile the KDE to be debugged, using a decent gcc/g++:
36
37 - gcc 2.96-*, which comes with Red Hat 7.2, is buggy. It sometimes
38 generates code with reads below %esp, even for simple functions.
39 This means you will be flooded with errors which are nothing to
sewardj365a8512002-07-01 08:30:05 +000040 do with your program. You can use the --workaround-gcc296-bugs=yes
41 flag to ignore them. See the manual for details; this is not really
42 a good solution.
sewardjde4a1d02002-03-22 01:27:54 +000043
44 - I recommend you use gcc/g++ 2.95.3. It seems to compile
45 KDE without problems, and does not suffer from the above bug. It's
46 what I have been using.
47
sewardj365a8512002-07-01 08:30:05 +000048 - gcc-3. 3.0.4 was observed to have a scheduling bug causing it to
49 occasionally generate writes below the stack pointer. gcc-3.1 seems
50 better in that respect.
sewardjde4a1d02002-03-22 01:27:54 +000051
52 It's ok to build Valgrind with the default gcc on Red Hat 7.2.
53
54
sewardj365a8512002-07-01 08:30:05 +000055* So: build valgrind -- see the README file. It's the standard
56 ./configure ; make ; make install deal.
sewardjde4a1d02002-03-22 01:27:54 +000057
58* Build as much of KDE+Qt as you can with -g and without -O, for
59 the usual reasons.
60
61* Use it!
62 /path/to/valgrind $KDEDIR/bin/kate
63 (or whatever).
64
65* If you are debugging KDE apps, be prepared for the fact that
66 Valgrind finds bugs in the underlying Qt (qt-copy from CVS) too.
67
68* Please read the Valgrind manual, docs/index.html. It contains
69 considerable details about how to use it, what's really going on,
70 etc.
71
sewardjde4a1d02002-03-22 01:27:54 +000072* There are some significant limitations:
sewardjde4a1d02002-03-22 01:27:54 +000073 - No MMX, SSE, SSE2 insns. Basically a 486 instruction set only.
74 - Various other minor limitations listed in the manual.
75
sewardj40183922002-06-19 20:52:32 +000076* If you have trouble with it, please let me know (jseward@acm.org)
77 and I'll see if I can help you out.
sewardjde4a1d02002-03-22 01:27:54 +000078
79
80Have fun! If you find Valgrind useful in finding and fixing bugs,
81I shall consider my efforts to have been worthwhile.
82
83Julian Seward (jseward@acm.org)