Welcome to the KDE Community Forums, the official forum board for KDE.
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
debugging kword 2.0
11 posts • Page 1 of 2
• 1, 2
debugging kword 2.0
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.
Re: debugging kword 2.0
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.
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.
Re: debugging kword 2.0
Still no one who can explain me why the breakpoints in other source file don't get reached? 

Re: debugging kword 2.0
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.
Re: debugging kword 2.0
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).
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).
Re: debugging kword 2.0
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
I doing this normally:
gdb ./kword
break KWView.cpp:100
run
Re: debugging kword 2.0
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 ?
)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 ?
Re: debugging kword 2.0
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.
Re: debugging kword 2.0
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
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
Re: debugging kword 2.0
That's correct. KWord starts and you have to open a document before the view is created and the breakpoint is reached.
11 posts • Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 2 guests

Search
FAQ
Policy
KDE.org
KDE.news
Planet KDE
More 