Translate

Jump to: navigation, search
Settings

Information about the group Translation of the wiki page Development/FAQs/Debugging FAQ.
Development/FAQs/Debugging FAQCurrent message text
...ugging FAQ/Page display title/elDevelopment/FAQs/Debugging FAQ
...elopment/FAQs/Debugging FAQ/1/el==Γενικά==
...elopment/FAQs/Debugging FAQ/2/el==Πώς μπορώ να αποφύγω τον Dr Konqi?==
...elopment/FAQs/Debugging FAQ/3/elYou must set the environment variable KDE_DEBUG (to 1 or whatever you want in fact).
...elopment/FAQs/Debugging FAQ/4/elTo get Dr Konqi back, unset the KDE_DEBUG environment variable.
...elopment/FAQs/Debugging FAQ/5/elExample:<br />
*To avoid Dr Konqi:
::<code>export KDE_DEBUG=1</code>
*To see Dr Konqi:
::<code>unset KDE_DEBUG</code>
...elopment/FAQs/Debugging FAQ/6/el===How do I switch Dr Konqi to developer mode?===
...elopment/FAQs/Debugging FAQ/7/elEdit file $KDEHOME/share/config/drkonqirc and add the following:
<syntaxhighlight lang="ini">
[drkonqi]
ConfigName=developer
</syntaxhighlight>
...elopment/FAQs/Debugging FAQ/8/el===What is a core file? How do I get a core file?===
...elopment/FAQs/Debugging FAQ/9/elA core file is an image of the memory when your application crashed. Using the core file, you can know which variables were set and where your application crashed.
...lopment/FAQs/Debugging FAQ/10/elSome distributions disable the generation of core files. To re-enable them, use <code>ulimit -c unlimited</code>.
...lopment/FAQs/Debugging FAQ/11/elOnce you have a core file for a crash, you can examine it with gdb appname core . This will open gdb on the core file for the given application. Once at the gdb prompt, the most useful command is <code>bt</code> which generates a backtrace of the crash.
For more information about how to use gdb, see [[Special:myLanguage/Development/Tutorials/Debugging/Debugging_with_GDB|this page]]
...lopment/FAQs/Debugging FAQ/12/el===Ποιά είναι τα διαθέσιμα εργαλεία για να κάνω αποσφαλμάτωση (debugging) την εφαρμογή μου?===
...lopment/FAQs/Debugging FAQ/13/el*kDebug() (kdDebug() in KDE3) calls are a simple but efficient way to debug an application.
*gdb, the GNU debugger, is the quickest way to execute step-by-step and investigate variables (recommended versions are gdb >= 6.x)
*Valgrind
*kdbg is a nice graphical frontend to gdb with a KDE GUI. It has support for many Qt types (including QString).
*Memory leak tracer : See kdesdk/kmtrace. The README explains it all.
*qdbus and dbusviewer from Qt allow to browse DBus interfaces and to easily make DBus calls.
...lopment/FAQs/Debugging FAQ/14/elCheck [[Special:myLanguage/Development/Tools|this page]] and kdesdk, there are a bunch of useful scripts there.
...lopment/FAQs/Debugging FAQ/15/el===How do I print a QString in gdb?===
...lopment/FAQs/Debugging FAQ/16/elCheck out kdesdk, and add this line to your ~/.gdbinit :
{{Input|1=source /path/to/kde/sources/kdesdk/scripts/kde-devel-gdb}}
Then in gdb you can do <code>printqstring myqstring</code> to see its contents.
For instance, <code>QString myqstring = QString::fromLatin1("contents");</code> can be examined using
...lopment/FAQs/Debugging FAQ/17/el{{Input|1=
(gdb) printqstring myqstring
$1 = "content"}}
...lopment/FAQs/Debugging FAQ/18/elSee the <tt>kde-devel-gdb</tt> file for the other macros it defines.
...lopment/FAQs/Debugging FAQ/19/el===I have no symbol when I debug an app that uses kpart, what should I do?===
...lopment/FAQs/Debugging FAQ/20/elYou must stop just after the main to load the debugging symbols of the shared library. After that, you can debug normally. 
One can go as far as creating a gdb macro, to stop right after the part was loaded. For kword, by example, I use:
{{Input|1=
define startkword
break main
run
break 'KoDocument::KoDocument(int, QWidget *, char const *, 
                       QObject *, char const *, bool)' cont}}
...lopment/FAQs/Debugging FAQ/21/el===How do I debug an ioslave?===
...lopment/FAQs/Debugging FAQ/22/elSee [[Development/Tutorials/Debugging/Debugging IOSlaves|debugging ioslaves]]
...lopment/FAQs/Debugging FAQ/23/el=== Why isn't my signal and slot connection working? ===
...lopment/FAQs/Debugging FAQ/24/elHere are some steps that you can use to troubleshoot why your signal/slot connection is not working (your slot does not get called for some reason).
...lopment/FAQs/Debugging FAQ/25/el1) Verify that the connect() doesn't print a warning to the console at runtime.
...lopment/FAQs/Debugging FAQ/26/elIf it does, check that you wrote Q_OBJECT, that the parameter names are not in the connect, that the parameter types are compatible, and that the slot is defined, and that the moc was compiled.
...lopment/FAQs/Debugging FAQ/27/el1b) Or you can just check to see what connect() returns as a bool. Although this won't give you the error message.
2) Verify that the signal is indeed emitted
3) Verify that the receiver isn't already deleted at that time
4) Verify that emitter->signalsBlocked() returns false
...lopment/FAQs/Debugging FAQ/28/el==KDE 4 specific==
...lopment/FAQs/Debugging FAQ/29/el===Is there a preferred way to print debug output on stderr?===
...lopment/FAQs/Debugging FAQ/30/elΝαι, πρέπει να χρησιμοποιείσεται το KDebug() :
...lopment/FAQs/Debugging FAQ/31/el<syntaxhighlight lang="cpp-qt">
#include <kdebug.h>
kDebug() << "KMyApp just started"; 
</syntaxhighlight>
...lopment/FAQs/Debugging FAQ/32/elThe syntax is much like cout, you can use many native types between the "<<". This will print out a debugging message, which will automatically be turned off at release time (by <tt>--disable-debug</tt>). In case you want the message to still be there during releases, because it's a warning or an error, use <tt>kWarning()</tt> or <tt>kError()</tt>.
...lopment/FAQs/Debugging FAQ/33/elComponents and libraries are advised to use a debug area number, as in kDebug(1234). For this, the number must be registered in kdelibs/kdecore/kdebug.areas. Debug areas make it possible to turn off or on the debug output for specific area numbers, using the {{program|kdebugdialog}} program, which is part of kdebase. <tt>kdebugdialog --fullmode</tt> also permits to control where to log debug output. It is usually not necessary to register area numbers for standalone applications, unless it's so complex that you want to divide the output into several areas.
...lopment/FAQs/Debugging FAQ/34/elIt is possible to omit the debug area number when calling kDebug by adding the following code to your top-level CMakeLists.txt:
...lopment/FAQs/Debugging FAQ/35/el<code>
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=XXXX) 
</code>
...lopment/FAQs/Debugging FAQ/36/elFor more information, about this, see [http://www.kdedevelopers.org/node/3171 Allen Winter's blog post].
...lopment/FAQs/Debugging FAQ/37/elTo make it clear: do NOT use <tt>qDebug()</tt>, this one does not get disabled at releases. Also avoid using <tt>assert()</tt> or <tt>kFatal()</tt> which lead to a crash when something goes wrong and that is not a nice experience for the user. Better detect the error, output a <tt>kWarning()</tt> or <tt>kError()</tt>, and recover if possible.
...lopment/FAQs/Debugging FAQ/38/elTo get timestamps with your debug output, which are useful for debugging multi-threaded, networked and asynchronous operations, <tt>export KDE_DEBUG_TIMESTAMP=1</tt> (for format 17:03:24), or <tt>export KDE_DEBUG_TIMESTAMP=2</tt> (for format 17:03:24.123) before running your app. Since KDE SC 4.5.
...lopment/FAQs/Debugging FAQ/39/el[[Category:FAQs]]
[[Category:Programming]]
NavigationShowing 40 messages.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal