Re: SoC: How to debug UNO packages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: SoC: How to debug UNO packages

Bruno Sant'Anna-2
Hi Thomas,

This debugging method is really appreciated =)

BTW something important:
I think I've found a bug in OOSDK,
I was trying to compile the service with the service XReplaceable, here are
the code:


css::uno::Reference < XReplaceable > xReplaceable (
paragraphClass.xTextDocument,UNO_QUERY);
css::uno::Reference < XReplaceDescriptor > xReplDesc =
xReplaceable->createReplaceDescriptor();
xReplDesc->setSearchString(vSentenceList[nSentenceIndex]);
xReplDesc->setReplaceString(sReplaceString);
xReplaceable->replaceAll(xReplDesc);

Unfortunatelly it wasn't compilling, the error message in console was very
strange, it was tolding that replaceAll method just was able to receive a
XSearchDescriptor object (not a XReplaceDescriptor object).

I decided to change de XReplaceable IDL file from source in
SDK_DIR/idl/com/sun/star/util/XReplaceable.idl

The method replaceall really was different,  so I commented the line and
create a new one:

//      long replaceAll( [in] com::sun::star::util::XSearchDescriptor xDesc
);
        long replaceAll( [in] com::sun::star::util::XReplaceDescriptor xDesc
);

After that it compiled properly, I don't know if I did something wrong... I
hope not because the code I posted above is so obvious! =)

I tried to post this on irc channel yesterday but almost everybody was
away...


Today I'll be sending to you a new version of service I hope you like it...
It is undelining sentences (char props), and i created a interactive console
too...

You will see it soon..


Best Regards

Bruno Sant'Anna

On 8/9/06, Thomas Lange <[hidden email]> wrote:

>
>
> Hello Jocelyn and Bruno,
>
> Since I just found out yesterday myself (actually I was told by a
> colleague ^_~) how to
> debug installed UNO packages I thought I'll drop you a mail about it
> since it might come
> in handy for both of you as well.
>
> 1) To the beginning of your Makefile add the following lines
>
> CSC_FLAGS = -warnaserror+ -incremental- -noconfig
> VBC_FLAGS = -warnaserror+
> ifeq "$(DEBUG)" "yes"
> CC_FLAGS+=-Zi -MT
> CSC_FLAGS += -debug+ -checked+ -define:DEBUG -define:TRACE
> VBC_FLAGS += -debug+ -define:DEBUG=1 -define:TRACE=1
> else
> CSC_FLAGS += -o
> endif
>
> You also need to modify the line CC_FLAGS+= to match your compilers
> debugging flags
> The above line is for Windows SDK.
> For SDK running with Linux I think it should be sth.like
> CC_FLAGS+=-g -O0
>
> 2) after remobing the old output tree (or running 'make clean') enter
>    make DEBUG=yes
> in the shell to build the project.
> Additionally to the files you usually get you will now as well get an
> *.pdb file
> for each executable and DLL.
>
> 3) Now you need to copy all the pdb files (i.e. all those that are part
> of the
> package) to the program directory of the office you are using with the
> SDK.
> Then just start the office deinstall any old version of the package and
> install the
> new version that was build along with the pdb files.
> Now you can step happily into the C++ functions and debug your code and/or
> set breakpoints in the source code as well.
>
>
> Thomas
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SoC: How to debug UNO packages

thomas.lange

Hi Bruno,

> BTW something important:
> I think I've found a bug in OOSDK,
> I was trying to compile the service with the service XReplaceable,
> here are the code:
>
>
> css::uno::Reference < XReplaceable > xReplaceable
> (paragraphClass.xTextDocument,UNO_QUERY);
> css::uno::Reference < XReplaceDescriptor > xReplDesc =
> xReplaceable->createReplaceDescriptor();
> xReplDesc->setSearchString(vSentenceList[nSentenceIndex]);
> xReplDesc->setReplaceString(sReplaceString);
> xReplaceable->replaceAll(xReplDesc);
Well it is not exactly a bug but a major oddity.
Since XReplaceDescriptor is derived from XSearchDescriptor you can of
course create a ReplaceDescriptor and
pass that one on to replaceAll (that's what is quite odd). It is not a
bug because when I checked with LXR all
implementations objects (for Writer, Calc, Draw/Impress) of
XSearchDescriptor also implement XReplaceDescriptor
(internally there is usually a single SearchAndRepalce object).
Additionally at least the Writer implementations use the somewhat dirty
XUnoTunnel interface to check if the object
that is passed as argument is it's own implementation object and then
uses functions of that object. (for example those
to access the 'replace' data).
But by doing so the implementation will not work with any other
implementation of that interface.
Which theoretically should be possible. :-/

I'll ask JSC what to do about the API definition of replaceAll.

In your code you simply need to create a XReplaceDescriptor and pass
that on to the replaceAll function.
You must not modify the IDL because that will be incompatible.

Regards,
Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]