Re: Review Request: A new runtime debugging output system for KOffice, ported from Amarok.

"David Faure" <[email protected]>
Newsgroups gmane.comp.kde.devel.koffice
Message-ID <[email protected]>

> On 2010-11-04 18:00:12, David Faure wrote:
> > I believe this should go to kdebug.h instead.
> 
> Mark Kretschmann wrote:
>     Good point. But until such time (next KDE release), it could go into KOffice, as we are nearing a release. It would be trivial to remove it later on, if KDE did indeed incorporate all of its features. And even if KDE 4.6 had all of the features, when would KOffice depend on it?
>     
>     I saw that you ported some of the features to kdebug (very nice), but not all of them.

I think it's a bad idea to switch debugging systems twice. You would have to get rid of all debug areas in koffice, which doesn't sound like a good idea, especially for later on coming back to kDebug!
And if you just leave both side by side and you don't port all the debugging from koffice to your framework, then the indenting of existing kDebug calls won't work.

Rather than going back and forth I suggest that you either
1) be patient and wait until koffice relies on kdelibs-4.6, or
2) copy KDebug's Block and macros to komain with an #if !KDE_IS_VERSION(4,5,74), so that you can start using it -without- the need to port anything again later. This will still break indentation inside blocks, but it will allow you to use the stuff, and if you want indentation you can just update to kdelibs trunk without requiring everyone else to.


The features that I didn't port, are either not useful and not documented (like PERF_LOG, which calls access(2) on random strings !?!?), or already provided by kdebug another way  (e.g. stamp() is less useful than kDebug(); with export KDE_DEBUG_FILELINE=1. Turning debugging on/off at runtime is already provided by kdebug too.
Which feature are you still missing from kdebug?


> On 2010-11-04 18:00:12, David Faure wrote:
> > trunk/koffice/libs/main/Debug.h, line 33
> > <http://svn.reviewboard.kde.org/r/5767/diff/1/?file=40616#file40616line33>
> >
> >     Already done by Q_FUNC_INFO
> 
> Mark Kretschmann wrote:
>     Would it do exactly the same? Even if Qt and/or the application are built without debug enabled?

Yes.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/5767/#review8507
-----------------------------------------------------------


On 2010-11-04 16:45:23, Mark Kretschmann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/5767/
> -----------------------------------------------------------
> 
> (Updated 2010-11-04 16:45:23)
> 
> 
> Review request for KOffice.
> 
> 
> Summary
> -------
> 
> This patch introduces the advanced runtime debugging system of Amarok to KOffice. It is meant to augment or replace the standard calls for debugging output, like qDebug() and kDebug(). While kDebug() certainly fulfills its purpose, it is really not much more than a printf() with some syntactic sugar on top. The new debugging system is far more powerful, much like a kDebug() on steroids.
> 
> 
> Features of the new system:
> 
> * Can be used just as easily as "kDebug()". The call can be replaced with "debug()", and the rest stays the same.
> * Features automatic visual indenting of nested code blocks in the output. This is very useful for quickly getting an overview of the nesting of methods. To use this, all that is needed is putting the macro "DEBUG_BLOCK" in a method.
> * Prints timing information for every method, and as a special bonus it checks if a method takes extremely long (the value is adjustable, default is 5 seconds), and then prints "DELAY". This makes it very easy to grep for methods that seem to block the application.
> * Does some coloring of the output, which helps to spot errors easily. The coloring is optional, which is important for color blind people, or those who simply dislike it.
> * The debugging system is meant to be enabled with a runtime switch, e.g. "koffice --debug", as opposed to compile time. The big advantage of this: Even users without a debug build are able to provide useful information, in case that they see a malfunction in the application. This has helped us numerous times in Amarok.
> * Sprinkling the code with "DEBUG_BLOCK" macros is easy to do, and also easy to remove. This macro is probably the most useful feature of the system, as it often helps with debugging hard-to-spot crashes, e.g. with a trashed stack. The attached screenshots should give you an impression of what it does.
> 
> 
> Pitfalls: 
> 
> One should not overuse the DEBUG_BLOCK feature. While it is very useful, using it too much leads to "debug spam". Ideally one should only put it in important methods like constructors and destructors.
> 
> 
> Known issues:
> 
> * The coding style is still that of Amarok. I would of course change the style to KOffice's later on.
> * The placing of the Debug class in the code tree is not ideal. I've put it in libs/main/ for now, but Boud noted that this is not the best location. I could move it to a better places easily.
> * Features that should be optional (like coloring) are currently hardcoded. This would of course be fixed, if the patch is welcome.
> * So far I have only used DEBUG_BLOCK in a few places in KOffice, for demonstration purposes. This could be extended later on.
> 
> 
> Notes on usage:
> 
> Please refer to the docs (comments) in the code. They explain the available features rather well.
> 
> 
> Diffs
> -----
> 
>   trunk/koffice/libs/main/Debug.h PRE-CREATION 
>   trunk/koffice/libs/main/Debug.cpp PRE-CREATION 
>   trunk/koffice/libs/main/Debug_p.h PRE-CREATION 
>   trunk/koffice/libs/main/KoApplication.cpp 1192436 
>   trunk/koffice/libs/main/KoApplicationAdaptor.cpp 1192436 
>   trunk/koffice/libs/main/KoDockerManager.cpp 1192436 
>   trunk/koffice/libs/main/KoDocument.cpp 1192436 
>   trunk/koffice/libs/main/KoGlobal.cpp 1192436 
>   trunk/koffice/libs/main/KoMainWindow.cpp 1192436 
> 
> Diff: http://svn.reviewboard.kde.org/r/5767/diff
> 
> 
> Testing
> -------
> 
> Started KWord, compared old debugging output to new output. Liked what I saw.
> 
> 
> Screenshots
> -----------
> 
> New Debug system in KWord
>   http://svn.reviewboard.kde.org/r/5767/s/547/
> Debug system as used in Amarok
>   http://svn.reviewboard.kde.org/r/5767/s/548/
> 
> 
> Thanks,
> 
> Mark
> 
>

_______________________________________________
koffice-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/koffice-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.