Difference between revisions of "Valgrind"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 25: Line 25:
 
<pre>
 
<pre>
 
G_SLICE=always-malloc valgrind ...
 
G_SLICE=always-malloc valgrind ...
 +
</pre>
 +
 +
== Errors Found ==
 +
 +
=== Definite Errors ===
 +
 +
Open as of <code>DEV300_m99</code>:
 +
 +
* {{issue|114718}} &ldquo;forms/qa/unoapi: crash in remote async release call&rdquo;
 +
* {{issue|116785}} &ldquo;framework::[Module]ImageManager kept alive by ring ref&rdquo;
 +
* {{issue|116786}} &ldquo;framework::ToolBarLayoutManger::m_p{AddonOptions,GlobalSettings} leak&rdquo;
 +
* {{issue|116850}} &ldquo;SvLBox::OnCurrentEntryChanged: Conditional jump or move depends on uninitialised value(s)&rdquo;
 +
 +
=== Potentially False Positives ===
 +
 +
<pre>
 +
Conditional jump or move depends on uninitialised value(s)
 +
  at 0x9440A18: XcursorImageHash (in /usr/lib/libXcursor.so.1.0.2)
 +
  by 0x9440ED7: XcursorNoticePutBitmap (in /usr/lib/libXcursor.so.1.0.2)
 +
  by 0x42F5EF8: _XNoticePutBitmap (in /usr/lib/libX11.so.6.3.0)
 +
  by 0x430D3A7: XPutImage (in /usr/lib/libX11.so.6.3.0)
 +
  by 0x938107E: ImplSalDDB::ImplSalDDB(_XImage*, unsigned long, int, SalTwoRect const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
 +
  by 0x9382E77: X11SalBitmap::ImplGetDDB(unsigned long, int, long, SalTwoRect const&) const (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
 +
  by 0x9382F52: X11SalBitmap::ImplDraw(unsigned long, int, long, SalTwoRect const&, _XGC* const&) const (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
 +
  by 0x937DC2A: X11SalGraphics::drawMaskedBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
 +
  by 0x937DF70: X11SalGraphics::drawBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
 +
  by 0x5BAE9FB: SalGraphics::DrawBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&, OutputDevice const*) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)
 +
  by 0x5B92D9C: OutputDevice::ImplDrawBitmapEx(Point const&, Size const&, Point const&, Size const&, BitmapEx const&, unsigned long) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)
 +
  by 0x5B9320D: OutputDevice::DrawBitmapEx(Point const&, Size const&, BitmapEx const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)
 +
</pre>
 +
might be a false positive, [http://code.google.com/p/microblog-purple/source/browse/branches/0.3/valgrind-suppressions?r=353#27] specifies a suppression block for the head of that stack,
 +
<pre>
 +
{
 +
  X oddness 3
 +
  Memcheck:Cond
 +
  fun:XcursorImageHash
 +
  fun:XcursorNoticePutBitmap
 +
  fun:_XNoticePutBitmap
 +
  fun:XPutImage
 +
}
 
</pre>
 
</pre>
  

Revision as of 13:26, 7 February 2011

Valgrind is an instrumentation framework for dynamic analysis tools. It can be used to detect memory management and threading bugs and profile programs. It runs on Linux x86 and AMD64, PPC32 and PPC64 are fairly complete.

disabling the custom allocator

If you use ooo-build; export OOO_FORCE_SYSALLOC=1 before running, (this is built into linkoo's ooenv script).

If you use a Vanilla build, and your shell is setup for building ooo, use the following wrapper script around valgrind:

#!/bin/sh

# instrument soffice with a malloc-based memory allocator.
# Requires libsalalloc_malloc.so to be in the LD_LIBRARY_PATH.
# Forwards all command line arguments to valgrind.

export LD_PRELOAD=libsalalloc_malloc.so
valgrind $@ 

which preloads a small interceptor lib, which redirects all allocator calls to malloc.

disabling glib's custom allocator

If you want to also track down problems with glib allocated objects, e.g. resource leaks in gconfbe then you need to disable glib's custom allocation as well, e.g.

G_SLICE=always-malloc valgrind ...

Errors Found

Definite Errors

Open as of DEV300_m99:

  • Issue 114718 “forms/qa/unoapi: crash in remote async release call”
  • Issue 116785 “framework::[Module]ImageManager kept alive by ring ref”
  • Issue 116786 “framework::ToolBarLayoutManger::m_p{AddonOptions,GlobalSettings} leak”
  • Issue 116850 “SvLBox::OnCurrentEntryChanged: Conditional jump or move depends on uninitialised value(s)”

Potentially False Positives

Conditional jump or move depends on uninitialised value(s)
   at 0x9440A18: XcursorImageHash (in /usr/lib/libXcursor.so.1.0.2)
   by 0x9440ED7: XcursorNoticePutBitmap (in /usr/lib/libXcursor.so.1.0.2)
   by 0x42F5EF8: _XNoticePutBitmap (in /usr/lib/libX11.so.6.3.0)
   by 0x430D3A7: XPutImage (in /usr/lib/libX11.so.6.3.0)
   by 0x938107E: ImplSalDDB::ImplSalDDB(_XImage*, unsigned long, int, SalTwoRect const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
   by 0x9382E77: X11SalBitmap::ImplGetDDB(unsigned long, int, long, SalTwoRect const&) const (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
   by 0x9382F52: X11SalBitmap::ImplDraw(unsigned long, int, long, SalTwoRect const&, _XGC* const&) const (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
   by 0x937DC2A: X11SalGraphics::drawMaskedBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
   by 0x937DF70: X11SalGraphics::drawBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclplug_genli.so)
   by 0x5BAE9FB: SalGraphics::DrawBitmap(SalTwoRect const*, SalBitmap const&, SalBitmap const&, OutputDevice const*) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)
   by 0x5B92D9C: OutputDevice::ImplDrawBitmapEx(Point const&, Size const&, Point const&, Size const&, BitmapEx const&, unsigned long) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)
   by 0x5B9320D: OutputDevice::DrawBitmapEx(Point const&, Size const&, BitmapEx const&) (in /cws/sb138_m98/DEV300/unxlngi6/installation/opt/openoffice.org/basis3.4/program/libvclli.so)

might be a false positive, [1] specifies a suppression block for the head of that stack,

{
   X oddness 3
   Memcheck:Cond
   fun:XcursorImageHash
   fun:XcursorNoticePutBitmap
   fun:_XNoticePutBitmap
   fun:XPutImage
}

more information

There's also some Writer document about Valgrind: http://tools.openoffice.org/debugging/usingvalgrind.sxw

TODO: move (!) its content here, not just copy but also remove there, so we don't end up with a fork.

TODO: Run recent version
Someone should run the latest version o OO.o, as Valgrind 3.3.0 re-introduces Hellgrind which helps e.g. to hunt down deadlocks. See [2] for more.

Callgrind Profiling How-To

There's a Callgrind How-To.

Personal tools