Tinymail debugging using refdbg and valgrind memory statistics



First of all, create yourself a GLib in /opt/glib-dbg:

export CVSROOT=:pserver:anonymous cvs gnome org:/cvs/gnome
cvs -z3 co glib
cd glib
./autogen.sh --disable-visibility --prefix=/opt/glib-dbg --enable-gc-friendly --disable-mem-pools
make
sudo make install

Install http://refdbg.sourceforge.net/ in /opt/refdbg/

Now do export LD_LIBRARY_PATH=/opt/glib-dbg:$LD_LIBRARY_PATH
Then just to make sure do export G_SLICE=always-malloc and export
G_DEBUG=gc-friendly

Compile tinymail using minimal options:

./autogen.sh --with-html-component=none --enable-gnome=no --prefix=/opt/tinymail
make
sudo make install

Now you can do things like this for debugging reference counting

/opt/refdbg/bin/refdbg -c "r0=<TnyMsgHeader> D:All ; addrule <TnyMsgHeaderListModel> D:All" /opt/tinymail/bin/tinymail

Just addrule to add new types. Use <GTypeYourType> if you are adding a
rule about a GType (like the tinymail ones are).

Or you can do *really* cool things like debugging GObject problems with
gdb:

/opt/refdbg/bin/refdbg -c "btnum=8 ; r0=B:Error" gdb --args /opt/tinymail/bin/tinymail

You can, this way, exclude problems about types. And include problems
about specific other types. Read about refdbg for more information about
this. It *will* increase your productivity while debugging a lot.

Valgrind'ing:

export G_SLICE=always-malloc
export G_DEBUG=gc-friendly

wget http://valgrind.org/downloads/valgrind-3.1.1.tar.bz2
tar jxvf valgrind-3.1.1.tar.bz2
cd valgrind-3.1.1
wget http://pvanhoof.be/files/project1.tar.gz
tar zxvf project1.tar.gz
cd project1
make
cd ..
patch -p0 < project1/valgrind_massif_ms_main.diff
./autogen.sh --prefix=/opt/valgrind
make
sudo make install

And now run project1/src/project1 and press "Go"

Or just use valgrind like this (you will not have to live memory-usage
statistical graph being redrawed while you're using tinymail):

/opt/valgrind/bin/valgrind --tool=massif /opt/tinymail/bin/tinymail and
when you close the tinymail demo-ui, you'll have a massif.$NUM.ps file
in your currect directory. Rotate that one to the left in for example
evince to see a graph of the memory usage during that session.


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]