Debugger: Forte 6 update 1 (dbx or workshop)
It's strongly recommended to install patch 109510-03 (109511-03 for x86), otherwise the debugger will die on setting certain (not at all uncommon) breakpoints.
The easiest way to set a breakpoint in a load on call shared library is to preload it: Example
(../dbx) loadobjects -p libsc638ss.so
(../dbx) stop in CreateScDocShellDll
(../dbx) run
Example:
(../dbx) intercept -a
will intercept all exceptions
(../dbx) intercept <typename>
will intercept exceptions of type <typename> if you have debug information at the place of throw()
Problem: OOo uses 16 bit quantities as Unicode characters (UCS2). Since wchar_t is 32 bit on most Unix platforms it's hard to decipher strings in OOo.
One possible solution:
Tools string:
(../dbx) print ((char*)&aString.mpData->maStr[0])[1..<desired.length*2>:2]
OUString:
(../dbx) print ((char*)&aString.pData->buffer[0])[1..<desired.length*2>:2]
For Solaris x86 you'll have to modify the line:
Tools string:
(../dbx) print ((char*)&aString.mpData->maStr[0])[0..<desired.length*2>:2]
OUString:
(../dbx) print ((char*)&aString.pData->buffer[0])[0..<desired.length*2>:2]
Caolan McNamara provided the following macro (place it in your .dbxrc) :
function pu
{
: ${1?"usage: $0 unicode_string # print unicode"}
len=$[($1).mpData->mnLen]
i=$[0]
str=""
while [ $i -lt $len ]
do
u=$[(char)((sal_Unicode*)&$1.mpData->maStr)[$i]]
str=$str$u
i=$[$i+1]
done
echo $str | sed -e "s/\'//g"
}
Example: stop on loading libsc638ss.so
(../dbx) stop dlopen libsc638ss.so
(gdb) print dbg_dump(sString)
Where sString is any of String/ByteString/rtl::OUString/rtl::OString. Providing extra overridden dbg_dump functions along the lines of the existing ones should provide the ability to extend the technique to any other string types that we have festering away somewhere, or of course any other custom types which might benefit from a human readable debugging view.
Any corrections and further suggestions/additions to this document are highly welcome.
Author: Jens-Heiner Rechtien (HR), last change 2001/08/01
The following is lifted straight from the mailing lists.
In that case when you want to debug a particular library/module you need to "cd <whatever module" e.g. "cd sw" for the Writer application. And then "build debug=true", then copy the built libraries into your OOo installation and point MSVisual C++ at it.
And perhaps more informational
debug OOo on windows platform: 1. Install VC++ 6.0 2. Install a oo643C Win build 3. Copy the dlls that contain debug info to local machine, and to replace the old files in <ooRoot>/program. 4. Create an empty project in VC. Goto Project -> Settings -> Debug Tab: For General -> Executable for debug session: , set "soffice.exe" For "Add additional dlls" -> Modules -> add the dlls. 5. Open some OOo source code and add some breakpoints. 6. Go debug!
The following might be a useful comment
Project->settings->debug->Category: select additional dlls. In the list area place the dlls that you will be debugging, i.e. c:\path\to\swXXXmi.dll
Make sure, your debug libraries get used by the soffice process (e.g. by explicitly copying them into the program directory). The MS debugger can be started simply with msdev out of your environment. Depending on your MSDEV version, you can simply start (6.x) msdev soffice.exe (.NET) msdev /someswitchidonotknow soffice.exe (I think with msdev /? you get a list of possible switches. , afterwards press F5 to start the process
And an extra comment was added
After copying the .PDB files to the program level the MVC++ Debugger seems to be detecting the debug info.
Caolan wrote a very good summary of debugging, volunteers to integrate this information please.