Debugging
This section assumes use of gdb, from the console. There are also specific notes on Windows Debugging and hints on Build Problems Debugging
Building with debugging symbols
OO.o includes a way to add debugging code in per module, via
the build debug=true
command in each module.
This also adds lots of runtime assertions,
churning warnings etc. in addition to debug symbols - which
can be useful. To do just a plain build with debug symbols
though use build debug=true dbg_build_only=true
You can also configure OO.o with --enable-symbols to build with symbolic generation.
gdb invocation
If you debug with gdb, you may find that execution stops due to signals at inappropiate locations, especially if running against libgcj and need to debug ignoring its garbage-collection. Best invocation is...
gdb ./soffice.bin (gdb) handle SIGPWR nostop noprint (gdb) handle SIGXCPU nostop noprint (gdb) handle SIG33 nostop noprint (gdb) run -writer
replace -writer with -draw/-impress/-calc/... as appropiate.
Starting at the beginning
We start in 'main' with a sal wrapper, that calls vcl/source/app/svmain.cxx (SVMain). It invokes Main on pSVData->mpApp; but pSVData is an in-line local. To debug this use the pImplSVData global variable. eg:
p pImplSVData->maAppData
This 'Main' method is typically: desktop/source/app/app.cxx (Main).
Examining strings
We have already seen that OO.o has
it's own set of string classes, none of which gdb understands.
You need to use:
(gdb) print dbg_dump(sWhatEver)
to print the contents
of a UniString/ByteString/rtl::OUString/rtl::OString regardless
of the type when debugging C++ code. See Caolan's
write-up
for details.
Getting the build order right
The build dependencies of the modules are clearly crucial to
getting a clean build. When you type 'build' in a module, first
build examines prj/build.list, eg.neon/prj/build.lst
:
xh neon : soltools external expat NULL
this specifies that 'soltools', 'external' and 'expat' have to be satisfactorily built and delivered before neon can be built. Occasionally these rules get broken, and people don't notice for a while.
It crashes, but only in gdb
What fun — you symlinked desktop/unxlngi4.pro/bin/soffice to
soffice.bin in your install tree didn't you. That works fine
if you just run it, but it seems gdb unpacks the symlink and
passes a fully qualified path as argv[0], which defeats the
hunting for the binary in the path, so it assigns the program
base path as /opt/OpenOffice/OOO_STABLE_1/desktop/unxlngi4.pro/bin
and starts looking for (eg. applicat.rdb) in there. Of course
when it fails to find any setup information, it silently
crashes somewhere else yards away from the original problem.
It crashes, but doesn't crash
For various reasons signal handlers are trapped and life can get rather confusing; thus it's best for builders to apply something like this:
--- sal/osl/unx/signal.c +++ sal/osl/unx/signal.c @@ -188,6 +188,8 @@ static sal_Bool InitSignal() bSetILLHandler = sal_True; } + bSetSEGVHandler = bSetWINCHHandler = bSetILLHandler = bDoHardKill = sal_False; + SignalListMutex = osl_createMutex(); act.sa_handler = SignalHandlerFunction;
I can't find the code from the trace
Some methods, are described as having a special linkage, such that they can be used in callbacks; these typically have a prefix: 'LinkStub', so search for the latter part of the identifier in a freetext search. eg.
IMPL_LINK( Window, ImplHandlePaintHdl, void*, EMPTYARG )
builds the 'LinkStubImplHandlePaintHdl' method.
How can I re-build just the files I see in the trace
Often when you run gdb on a build without debugging symbols, you get an unhelpful gdb trace, but yet you can't afford the time/space to recompile all of OO.o with debugging symbols. Thus we have created a small perl helper, which will hunt for & touch files containing the symbols from your trace. This sub-set can then be re-built with debugging enabled for a better trace next time around:
gdb ./soffice.bin ... bt #0 0x40b4e0a1 in kill () from /lib/libc.so.6 #1 0x409acfe6 in raise () from /lib/libpthread.so.0 #2 0x447bcdbd in SfxMedium::DownLoad(Link const&) () from ./libsfx641li.so #3 0x447be151 in SfxMedium::SfxMedium(String const&, unsigned short, unsigned char, SfxFilter const*, SfxItemSet*) () from ./libsfx641li.so #4 0x448339d3 in getCppuType(com::sun::star::uno::Reference<com::sun::star::document::XImporter> const*) () from ./libsfx641li.so ... quit cd base/OOO_STABLE_1/sfx2 ootouch SfxMedium build debug=true
Thus, all files referencing / implementing anything with SfxMedium will be touched, and hence rebuilt with debugging symbols.
How can I re-build all the files in one source directory
If you want to recompile the code in just your current directory, you can use the killobj dmake target to remove the object files:
dmake killobj dmake
It always crashes in sal_XErrorHdl
You are a victim of asynchronous X error reporting;
export SAL_SYNCHRONIZE=1
will make all the X traffic
synchronous, and report the error by the method that caused it,
it'll also make OO.o far slower, and the timing different.
It silently fails to load my word file
Caolan suggests: put breakpoints in ww8par.cxx top and tail of SwWW8ImplReader::LoadDoc, and confirm that the document gets as far as the import filter.
A handy human place to put a breakpoint is in SwWW8ImplReader::ReadPlainChars, you can see chunks of text as they are read in. Alternatively SwWW8ImplReader::AppendTxtNode as each paragraph is inserted.
How do I use the debug console ?
So OO.o contains some hefty debugging infrastructure; pictured here
Enabling it is pretty easy - what you need is a so-called Non-Product Build.
By default, an OpenOffice.org build is a Product Build, i.e. ready for release after completion. If you specifiy the --enable-dbgutil
switch during configure
, then your environment will be prepared for a Non-Product Build - with lots of additional diagnostic tools.
Note that libraries from product and non-product builds are usually incompatible, so don't mix them in the same installation.
For available tools in non-product builds, have a look at the various DBG_foo
macros in tools/debug.hxx
, or, if you already are knowledgeable about this, let others participate by writing your knowledge down here.
To actually fire up the debug settings dialog, press <ctrl><alt><shift>-D.
Excel Interop debugging
This is fairly easy; edit sc/source/filter/inc/biffdump.hxx,
define EXC_INCL_DUMPER to 1, and re-build 'sc'. Also, copy
sc/source/filter/excel/biffrecdumper.ini to ~. Then run
soffice.bin foo.xls
and you should get a
foo.txt with the debug data in it.
The trace shows a crash in 'poll'
OO.o is a fairly threaded program, you're prolly just looking
at the wrong thread: there are not likely to be bugs in poll.
Use thread apply all backtrace
to get a backtrace
of all threads - this will most likely fail. When it does do:
thread 1
then bt
- most crashers
occur in the 'main' thread.
What does this trace mean ?
There are several typical stack-traces that come up again and again, one would be:
#15 0x4164a501 in raise () from /lib/tls/libc.so.6 #16 0x4164bcd9 in abort () from /lib/tls/libc.so.6 #17 0x415fb5a5 in std::set_unexpected () from /home/mnagashree/m72install/program/libstdc++.so.5 #18 0x415fb5e2 in std::terminate () from /home/mnagashree/m72install/program/libstdc++.so.5 #19 0x415fb69c in __cxa_rethrow ()
This section of trace means (essentially) that an exception was thrown - but there was no-one trying to catch it. Often this means there was a missing 'try {} catch()' clause in one of the calling frames.
A great way to debug exceptions is to add a breakpoint
in catch/throw, do this with catch throw
or
catch catch
in gdb.
STLport and checking iterators
The STL is a powerful tool but it also makes it easy - in the grand old C/C++ tradition - to shoot one selves in the foot, as we all know. STL containers and algorithms are now pervasive in OOo, so there is a need to validate the use of STL constructs in OO.o to find hidden problems.
Fortunately the STLport library - the default STL implementation for OO.o - has a powerful debug mode, and it's easy to use. Since SRC680 m128 it is possible to use the environment variable USE_STLP_DEBUG
to switch on the STLport debug mode, since SRC680 m150 it works for Windows, too
The most useful part of the STLport debug mode is iterator checking. Doing the OO.o smoke test and some little additional random testing we already found a number of questionable STL constructs.
Only code paths which are exercised will be tested by the STLport debug mode, though. If STLport finds a questionable STL usage it will throw an assertion and terminate. It is usually quite easy to extract a precise stack trace.
Some notes:
- STLport debug mode iterators are no pointers! We've cleaned up all occurrences of the lazy - and wrong - usages of iterators as pointers in SRC680 m128/m150, but maybe something new has already crept in. This clean up also helps with other STL implementations, like the one which comes with gcc-4.x
- A complete recompile is necessary, the debug modes renders all objects with STL constructs binary incompatible
- The STLport debug mode breaks the complexity assertions of the STL. Theoretically some operations should be much slower in debug mode than in product mode. In practice I didn't notice a real slowdown of OO.o.
phentermine allegra d acyclovir adipex aldara alesse ambien buspar buy phentermine carisoprodol celexa cheap viagra cholesterol cialis condylox cyclobenzaprine denavir diflucan effexor famvir ioricet flexeril flonase fluoxetine generic viagra imitrex levitra lexapro lipitor nexium ortho evra ortho tricyclen phentermine prevacid prilosec propecia prozac renova retin-a soma tramadol triphasil ultracet ultram altrex vaniqa viagra xenical yasmin zanaflex zithromax zoloft zovirax zyban
zyrtec
BEST CASINO BEST CRAPS BEST POKER BEST ROULETTE CASINO FREE CASINOS BACCARAT INTERNET CRAPS INTERNET SLOTS ONLINE CASINO ONLINE CASINOS ONLINE SLOTS PLAY CASINO PLAY CASINOS PLAY CRAPS internet casino poker online poker gambling internet casino online casinos blackjack roulette craps slots bingo baccarat keno video poker PLAY ROULETTE ROULETTE SLOTS ONLINE VIDEO POKER BEST BLACKJACK BEST CASINO BEST CRAPS BEST POKER BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE BLACKJACK CASINO CASINOS ONLINE CRAPS GAME CRAPS FREE CASINO FREE CASINOS BEST-ONLINE-CASINO INTERNET BLACKJACK INTERNET CASINO INTERNET CASINOS INTERNET CRAPS INTERNET POKER ONLINE CASINOS ONLINE CRAPS ONLINE POKER ONLINE ROULETTE PLAY BLACKJACK PLAY CASINO PLAY CASINOS PLAY CRAPS PLAY POKER PLAY ROULETTE PLAY SLOTS POKER GAME POKER ROULETTE GAME ROULETTE ONLINE ROULETTE SLOTS GAME SLOTS ONLINE SLOTS BEST CASINO BEST CASINOS BEST CRAPS BEST POKER BLACKJACK CASINO GAMES CASINO ONLINE CASINO CASINOS ONLINE CASINOS CRAPS GAME CRAPS ONLINE CRAPS FREE CASINOS BINGO INTERNET BLACKJACK INTERNET CASINO INTERNET ROULETTE ONLINE BLACKJACK ONLINE CASINOS ONLINE CRAPS ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY CASINO PLAY CRAPS POKER GAME POKER ROOM POKER ROULETTE ONLINE ROULETTE SLOTS GAME SLOTS ONLINE SLOTS BEST BLACKJACK BEST CASINO BEST CRAPS BEST ROULETTE BEST SLOTS BLACKJACK ONLINE BLACKJACK CASINO GAMES CASINO ONLINE CASINO CASINOS CRAPS GAME CRAPS ONLINE FREE CASINOS BLACKJACK INTERNET CASINO INTERNET CRAPS INTERNET SLOTS ONLINE BLACKJACK ONLINE CASINO ONLINE CASINOS ONLINE ROULETTE ONLINE SLOTS PLAY CASINO PLAY CASINOS PLAY POKER PLAY SLOTS POKER GAME POKER ONLINE POKER ROOM POKER ROULETTE ONLINE ROULETTE SLOTS ONLINE SLOTS BEST BLACKJACK BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE BLACKJACK CASINO GAMES CASINOS ONLINE CASINOS CRAPS ONLINE CASINO-BONUS ONLINE BLACKJACK ONLINE CASINOS ONLINE ROULETTE ONLINE SLOTS PLAY POKER POKER GAME POKER ROULETTE GAME ROULETTE ONLINE ROULETTE BEST BLACKJACK BEST CRAPS BEST SLOTS BLACKJACK GAME CASINO ONLINE FREE CASINOS CASINO-GAME-ONLINE INTERNET [1] INTERNET POKER INTERNET SLOTS ONLINE CASINO ONLINE CRAPS ONLINE POKER ONLINE SLOTS PLAY CRAPS PLAY POKER BEST BLACKJACK BEST CRAPS BLACKJACK ONLINE CASINO GAMES CASINO CASINO-JACKPOT INTERNET BLACKJACK INTERNET CASINO INTERNET CRAPS INTERNET ROULETTE ONLINE CASINO PLAY CASINO PLAY CRAPS PLAY SLOTS POKER ROOM ROULETTE ONLINE VIDEO POKER BEST ROULETTE BEST SLOTS BLACKJACK GAME CRAPS CASINO-RATINGS ONLINE BLACKJACK ONLINE POKER PLAY CASINO PLAY POKER PLAY SLOTS POKER ROULETTE ONLINE BEST BLACKJACK BEST CASINOS BEST CRAPS BEST ROULETTE CASINO GAMES CASINO ONLINE CASINOS ONLINE CASINOS CRAPS GAME FREE CASINO CASINO INTERNET CASINO INTERNET CASINOS INTERNET ROULETTE ONLINE CASINO ONLINE CASINOS ONLINE CRAPS ONLINE POKER ONLINE ROULETTE PLAY BLACKJACK PLAY CASINOS PLAY CRAPS PLAY POKER PLAY ROULETTE POKER GAME POKER ONLINE POKER ROULETTE GAME SLOTS GAME BEST BLACKJACK BEST CASINOS BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE BLACKJACK CASINO GAMES CASINO ONLINE CRAPS ONLINE CRAPS CRAPS INTERNET CASINO INTERNET CASINOS INTERNET CRAPS INTERNET POKER INTERNET SLOTS ONLINE CASINO ONLINE POKER ONLINE ROULETTE PLAY BLACKJACK PLAY CASINO PLAY CRAPS PLAY ROULETTE PLAY SLOTS POKER ONLINE POKER ROULETTE GAME ROULETTE ONLINE ROULETTE VIDEO POKER BEST CASINOS BEST SLOTS CASINO CRAPS GAME HOLD-EM-POKER INTERNET BLACKJACK INTERNET POKER ONLINE BLACKJACK ONLINE CASINOS POKER GAME POKER ROOM POKER ROULETTE SLOTS ONLINE BEST BLACKJACK BEST CASINOS BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK CASINO GAMES CASINO ONLINE CASINO CASINOS CRAPS GAME CRAPS FREE CASINO INTERNET-CASINO INTERNET CASINO INTERNET CASINOS INTERNET ROULETTE ONLINE BLACKJACK ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY BLACKJACK PLAY CASINOS PLAY POKER POKER GAME POKER ROOM ROULETTE ONLINE ROULETTE VIDEO POKER BEST CASINO BEST CASINOS BEST CRAPS BLACKJACK CASINO GAMES CRAPS GAME CRAPS ONLINE CRAPS FREE CASINO NET-CASINO INTERNET CRAPS INTERNET POKER INTERNET SLOTS ONLINE POKER ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY CRAPS PLAY ROULETTE POKER GAME ROULETTE GAME VIDEO POKER BEST BLACKJACK BEST CASINOS BEST CRAPS BEST POKER BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE CASINO GAMES CASINO CASINOS CRAPS GAME CRAPS FREE CASINOS ON-LINE-POKER INTERNET BLACKJACK INTERNET CRAPS INTERNET POKER INTERNET ROULETTE ONLINE BLACKJACK ONLINE CASINO ONLINE CASINOS ONLINE CRAPS ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY CASINO PLAY POKER PLAY ROULETTE POKER GAME POKER ONLINE POKER ROOM POKER ROULETTE ONLINE ROULETTE SLOTS GAME SLOTS ONLINE VIDEO POKER BEST BLACKJACK BEST SLOTS BLACKJACK ONLINE BLACKJACK CASINOS ONLINE CASINOS ONLINE-CASINO-GAMBLING ONLINE CRAPS ONLINE POKER PLAY SLOTS SLOTS ONLINE VIDEO POKER BEST BLACKJACK BEST CASINO BEST CASINOS BEST CRAPS BEST POKER BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE BLACKJACK CASINO ONLINE CASINOS ONLINE CRAPS GAME CRAPS ONLINE CRAPS FREE CASINO ONLINE-CASINO-GAMES INTERNET BLACKJACK INTERNET CASINO INTERNET CASINOS INTERNET CRAPS INTERNET POKER INTERNET SLOTS ONLINE BLACKJACK ONLINE CASINO ONLINE CASINOS ONLINE CRAPS ONLINE POKER ONLINE ROULETTE PLAY BLACKJACK PLAY CASINO PLAY CRAPS PLAY POKER PLAY ROULETTE PLAY SLOTS POKER ONLINE POKER ROOM POKER ROULETTE GAME SLOTS GAME SLOTS BEST CASINO BEST CASINOS BEST CRAPS BEST POKER BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE CASINO GAMES CASINO CASINOS CRAPS GAME CRAPS ONLINE CRAPS FREE CASINO FREE CASINOS ONLINE-CASINO-NEWS INTERNET BLACKJACK INTERNET CASINO INTERNET CASINOS INTERNET POKER INTERNET SLOTS ONLINE BLACKJACK ONLINE CASINO ONLINE CRAPS ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY CASINOS PLAY CRAPS PLAY POKER PLAY SLOTS POKER SLOTS ONLINE VIDEO POKER BEST CASINO BEST POKER BLACKJACK GAME CASINOS CRAPS ONLINE CRAPS ONLINE-CASINO ONLINE BLACKJACK ONLINE CASINOS ONLINE CRAPS ONLINE SLOTS PLAY CASINOS POKER ONLINE POKER ROOM SLOTS GAME SLOTS ONLINE BEST BLACKJACK BEST CASINO BEST CASINOS BEST CRAPS BEST POKER BEST ROULETTE BEST SLOTS BLACKJACK GAME BLACKJACK ONLINE BLACKJACK CASINO ONLINE CASINO CASINOS ONLINE CASINOS CRAPS GAME CRAPS ONLINE CRAPS FREE CASINO ONLINE-CASINOS INTERNET BLACKJACK INTERNET CASINO INTERNET CASINOS INTERNET CRAPS INTERNET POKER INTERNET ROULETTE ONLINE BLACKJACK ONLINE CASINOS ONLINE CRAPS ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY POKER PLAY ROULETTE PLAY SLOTS POKER GAME POKER ROOM POKER ROULETTE GAME ROULETTE ONLINE SLOTS GAME VIDEO POKER BEST POKER BEST SLOTS BLACKJACK ONLINE CASINO ONLINE CASINO CASINOS ONLINE CASINOS CRAPS PARTY-POKER INTERNET BLACKJACK INTERNET CASINO INTERNET ROULETTE ONLINE BLACKJACK ONLINE CRAPS ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY POKER POKER GAME POKER ONLINE POKER ROOM SLOTS GAME BEST CASINOS BEST CRAPS BEST POKER BLACKJACK ONLINE BLACKJACK CASINO GAMES CASINO ONLINE CASINO CASINOS ONLINE CASINOS CRAPS FREE CASINOS POKER-TABLES INTERNET CASINOS INTERNET CRAPS INTERNET POKER ONLINE BLACKJACK ONLINE CASINO ONLINE CRAPS ONLINE POKER ONLINE SLOTS PLAY BLACKJACK PLAY CASINOS PLAY CRAPS PLAY SLOTS POKER SLOTS GAME SLOTS VIDEO POKER BEST BLACKJACK BEST CASINO BEST CASINOS BEST CRAPS BEST POKER BEST ROULETTE BLACKJACK CASINOS ONLINE CASINOS CRAPS POKER INTERNET BLACKJACK INTERNET CASINO INTERNET CASINOS INTERNET POKER ONLINE BLACKJACK ONLINE ROULETTE ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY CASINOS PLAY CRAPS PLAY ROULETTE PLAY SLOTS POKER GAME POKER ROOM ROULETTE SLOTS GAME SLOTS BEST BLACKJACK BEST SLOTS BLACKJACK GAME ROULETTE ONLINE CASINOS ONLINE POKER PLAY BLACKJACK PLAY ROULETTE POKER GAME POKER ROOM ROULETTE GAME ROULETTE ONLINE ROULETTE BEST BLACKJACK BEST CASINO BEST CASINOS BEST CRAPS BEST SLOTS CASINO GAMES CASINO ONLINE CASINOS CRAPS GAME FREE CASINO RULES-POKER INTERNET BLACKJACK INTERNET CRAPS INTERNET POKER INTERNET ROULETTE INTERNET SLOTS ONLINE CASINO ONLINE CASINOS ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY CASINO PLAY CRAPS PLAY SLOTS POKER GAME POKER ROOM POKER ROULETTE SLOTS GAME BEST CASINO BEST CASINOS BEST ROULETTE BEST SLOTS BLACKJACK ONLINE CASINO CASINOS ONLINE FREE CASINO FREE CASINOS SPORTS-GAMBLING INTERNET CASINO INTERNET CASINOS INTERNET POKER INTERNET ROULETTE ONLINE BLACKJACK ONLINE CASINO ONLINE CRAPS ONLINE POKER ONLINE ROULETTE ONLINE SLOTS PLAY BLACKJACK PLAY CASINO PLAY CASINOS PLAY POKER PLAY SLOTS POKER GAME POKER ONLINE POKER ROOM POKER ROULETTE GAME ROULETTE ONLINE
SLOTS