This information is about LibreOffice 3.5 and later.
Make a developer install
Once you have completed BuildingLibreOffice (regardless of if you use a developer or a release build) you can do:
to do a developer installation of LibreOffice inside the build directory. For that you don't need to change your system and you do not require root privileges. The advantage of the dev-install is, that it symlinks the libraries to the build directories, so if you do source changes and recompile you don't need to "reinstall" (which adds up quickly for LibreOffice if you do it again and again).
Debug your developer installation
If you have finished your dev-install, you should be able to do
which will start gdb set to your local LibreOffice installation, so you can generate stacktraces etc.
recompiling modules with debug symbols
In theory, one could compile all of LibreOffice with debug symbols and logging. In practice, there would be lots of unrelated noise in the logs and the build would be huge and slow. So one usually recompile one module one is interested in with debug information:
cd sw/ make clean make debug=true dbglevel=2
The dev-install now has debug information for writer. see: http://wiki.documentfoundation.org/Development/Native_Build#Partial_debug_build for details.
logging and tracing
export SAL_LOG=+INFO,+WARN make debugrun # or cd install/program/ && ./soffice.bin
The SAL_LOG variable allows rather finegrained control on what gets logged. see the sal/log.hxx comment for details.
More information on debugging LibreOffice is at http://wiki.documentfoundation.org/Development/How_to_debug