Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD7DB7EC6 for ; Sun, 27 Nov 2011 20:35:10 +0000 (UTC) Received: (qmail 99592 invoked by uid 500); 27 Nov 2011 20:35:10 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 99519 invoked by uid 500); 27 Nov 2011 20:35:10 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 99508 invoked by uid 99); 27 Nov 2011 20:35:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Nov 2011 20:35:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Nov 2011 20:35:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 39D7C2388A40; Sun, 27 Nov 2011 20:34:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1206837 - in /incubator/ooo/ooo-site/trunk/content/tools/debugging: ./ debugtips.html usingvalgrind.sxw windows/ Date: Sun, 27 Nov 2011 20:34:49 -0000 To: ooo-commits@incubator.apache.org From: kschenk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111127203449.39D7C2388A40@eris.apache.org> Author: kschenk Date: Sun Nov 27 20:34:48 2011 New Revision: 1206837 URL: http://svn.apache.org/viewvc?rev=1206837&view=rev Log: kls -- added tools/debugging Added: incubator/ooo/ooo-site/trunk/content/tools/debugging/ incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html (with props) incubator/ooo/ooo-site/trunk/content/tools/debugging/usingvalgrind.sxw (with props) incubator/ooo/ooo-site/trunk/content/tools/debugging/windows/ Added: incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html?rev=1206837&view=auto ============================================================================== --- incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html (added) +++ incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html Sun Nov 27 20:34:48 2011 @@ -0,0 +1,137 @@ + + + + + Debugging tips + + + + + +

Tips for debugging OpenOffice under Unix

+

Solaris

+

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.

+

1) How to set breakpoints in not yet loaded shared libraries

+

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

+

2) How to catch exceptions

+

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()

+

3) How to display Unicode strings

+

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"
}

+4) How to intercept the dynamic loading of shared libraries

+

Example: stop on loading libsc638ss.so

+

(../dbx) stop dlopen libsc638ss.so

+



+

+

Linux

+

TBD.

+

How to display Unicode Strings

+

(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.

+

Addendum

+

Any corrections and further suggestions/additions to this document +are highly welcome.

+

Author: Jens-Heiner +Rechtien (HR), last change 2001/08/01

+

Tips for debugging OpenOffice under Windows

+

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
+
+

Some hints that appear to be Win 2000 specific

+
+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.

+ + +

For more information on debugging

+

Caolan wrote a very good + +summary of debugging, volunteers to integrate this information please.

+ + + Propchange: incubator/ooo/ooo-site/trunk/content/tools/debugging/debugtips.html ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/ooo/ooo-site/trunk/content/tools/debugging/usingvalgrind.sxw URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/tools/debugging/usingvalgrind.sxw?rev=1206837&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/ooo/ooo-site/trunk/content/tools/debugging/usingvalgrind.sxw ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream