This forum has been archived. All content is frozen. Please use KDE Discuss instead.

debugging kword 2.0

Tags: None
(comma "," separated)
xyfix
Registered Member
Posts
110
Karma
0

debugging kword 2.0

Tue Oct 20, 2009 3:57 pm
I'm trying to debug (ddd/gdb) koffice2.0/kword and it at first sight it looks ok, I can see and debug main.cpp, KoApplication.cpp and many more. But I can't seem to be able to load sources like KWord.cpp or other .cpp files in the kword/part directory. Can somebody shed some light on this please? And another question, I can't understand how the KoApplication object in main.cpp (the file is by the way the same for kword/kpresenter....) is able to know which application (kword/kpresenter..) to start? I tried debugging but couldn't find it, perhaps it has to do with my other question above.
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Wed Oct 21, 2009 11:49 am
I found the answer of my second question here http://www.koffice.org/developer/apidocs/ ( thanks to cyrille )

Q: How does KoMainWindow->show() bring up the correct application (how does it know we want to show one app or another)?

A: The KoMainWindow is the same for all. But KoDocumentEntry was created from specific application data, and koQueryTrader klopens the library containing this component. The very same mechanism is used to 1) embed other components inside the app, 2) create any kind of koffice document, e.g. in koshell. All the KOffice applications are in fact very small wrappers that simply dlopen their own compnent - with the code in kofficecore, which can also dlopen ANY component.
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Tue Oct 27, 2009 8:11 am
Still no one who can explain me why the breakpoints in other source file don't get reached? :|
slangkamp
KDE Developer
Posts
607
Karma
4

Re: debugging kword 2.0

Tue Oct 27, 2009 4:32 pm
Can you describe a bit more what you did? There could be various problems, might even be that the line isn't reached or something like that.
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Wed Oct 28, 2009 12:33 pm
all right slangkamp,

I setup the build environment according to this http://wiki.koffice.org/index.php?title ... plications . Compiling and building seems to go OK and I get a debug build ( the size of the binary is to big for a release version), when I open this executable in ddd, I only get the kword_dummy.cpp source file. When I put a breakpoint on the main... line, it gets hit but when I do a step suddenly kword pops up, without showing any other lines of code. And when I try to open up another source file, I can't choose any (except for a few files I don't know and surely don't belong to the code).
slangkamp
KDE Developer
Posts
607
Karma
4

Re: debugging kword 2.0

Wed Oct 28, 2009 2:41 pm
Starting in main.cpp isn't really useful. The other code is loaded by a shared library, that's why the code isn't available. I would suggest you put a breakpoint e.g. in KWView.cpp

I doing this normally:
gdb ./kword
break KWView.cpp:100
run
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Tue Nov 03, 2009 8:28 am
Sorry Slangkamp for this late reply, but I had a rough weekend (mexican flue..I think ;-) )

But as far as I can see, the load shared library option is turned on (in ddd-> gdb settings) but still when I put a breakpoint in main.cpp and try to step into the code Kword just pops up. Can it be that this library isn't compiled with debug flags? In the sources window of ddd I can't see any files relating to KW.... , is the another option besides the sharedlibrary one in gdb ?
slangkamp
KDE Developer
Posts
607
Karma
4

Re: debugging kword 2.0

Tue Nov 03, 2009 4:27 pm
You can't step from the main.cpp into the main KWord code, that's due to the way the loading is done. You have to set the breakpoint directly at a point inside the KWord code. I don't know how you can set a breakpoint with ddd.
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Tue Nov 03, 2009 4:53 pm
slangkamp,

I tried your advice, but still kword just pops up and the breakpoint isn't struck


~/koffice-2.0/src/kword/part ]$ gdb ./kword
GNU gdb (GDB; openSUSE 11.1) 6.8.50.20081120-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-suse-linux".
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>...
(gdb) break KWView.cpp:100
No source file named KWView.cpp.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (KWView.cpp:100) pending.
(gdb) run
Starting program: /home/admin/koffice-2.0/src/kword/part/kword
[Thread debugging using libthread_db enabled]
QObject::connect: Cannot connect KoDocumentInfo::infoUpdated(const QString &, const QString &) to (null)::documentInformationUpdated(const QString &, const QString &)
QPainter::begin: Cannot paint on a null pixmap
QPainter::begin: Cannot paint on a null pixmap
slangkamp
KDE Developer
Posts
607
Karma
4

Re: debugging kword 2.0

Tue Nov 03, 2009 5:40 pm
That's correct. KWord starts and you have to open a document before the view is created and the breakpoint is reached.
xyfix
Registered Member
Posts
110
Karma
0

Re: debugging kword 2.0

Fri Nov 06, 2009 10:34 am
Ok, I managed to succeed ( don't ask me how yet ), I can start a debug session an go from kword_dummy.cpp to the main.cpp of kword and from there to other source files with ddd. Again I don't know yet how I managed this, but it might be that I did a "make clean" on the top directory and ran a "make" from the kword directory instead of running "make kword" from the top directory (???). Can somebody confirm this theory, since both procedures should be the same? Still there are some issues with variables, ddd is telling me that the variable is not in the scope while I'm pretty sure it is but that I will google myself...any suggestions are welcome though.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan