Registered Member
|
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.
|
Registered Member
|
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. |
Registered Member
|
Still no one who can explain me why the breakpoints in other source file don't get reached?
|
KDE Developer
|
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.
|
Registered Member
|
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). |
KDE Developer
|
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 |
Registered Member
|
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 ? |
KDE Developer
|
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.
|
Registered Member
|
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 |
KDE Developer
|
That's correct. KWord starts and you have to open a document before the view is created and the breakpoint is reached.
|
Registered Member
|
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.
|
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan