(→Notes) |
(→Debugging with DebugView) |
||
Line 1: | Line 1: | ||
=General Hints= | =General Hints= | ||
+ | ==Debugging with WinDbg== | ||
+ | *WinDbg, distributed as a part of ''Debugging Tools for Windows'', is a user-mode and kernel-mode debugger with a graphical interface. It can also be used to debug user-mode crash dumps. It uses the Microsoft Visual Studio debug symbol formats for source-level debugging. [[Projects/KDE_on_Windows/Tools#Debugging_Tools_for_Windows|more...]] | ||
+ | |||
==Debugging with DebugView== | ==Debugging with DebugView== | ||
Debug messages (logs) generated by kDebug() and kWarning() are not visible on MS Windows unless application is compiled in so-called CONSOLE subsystem. To show these messages also in WINDOWS subsystem, you can use DebugView tool, coming from SysInternals (currently acquired by Microsoft). [[Projects/KDE_on_Windows/Tools#DebugView|more...]] | Debug messages (logs) generated by kDebug() and kWarning() are not visible on MS Windows unless application is compiled in so-called CONSOLE subsystem. To show these messages also in WINDOWS subsystem, you can use DebugView tool, coming from SysInternals (currently acquired by Microsoft). [[Projects/KDE_on_Windows/Tools#DebugView|more...]] |
Debug messages (logs) generated by kDebug() and kWarning() are not visible on MS Windows unless application is compiled in so-called CONSOLE subsystem. To show these messages also in WINDOWS subsystem, you can use DebugView tool, coming from SysInternals (currently acquired by Microsoft). more...
kioslaves on windows are started by klauncher (or kio) as separate kioslave processes. The kioslave executable then loads the related kioslave dll dynamically.
To debug kioslaves:
set KDE_SLAVE_DEBUG_WAIT=file
If the kioslave is requested the next time, a debugger will be started and attached to the kioslave process immediatly before the kioslave's kdemain() function.
On mingw platform gdb is launched and connected to the kioslave process. On msvc platforms the currently installed just-in-time debugger is used. This may be msvc's IDE or the windbg debugger. The latter could be set as jit-debugger by running 'windbg -I' command.
Alternatively, you can set KDE_SLAVE_DEBUG_POPUP variable instead of KDE_SLAVE_DEBUG_WAIT. This will display a native message box so developer you can attach the debugger to the KIO slave process and click OK. No DebugBreak() is invoked. Just click OK without attaching to continue using the KIO slave without debugging.
Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. more...
Let's assume you're using command line tools (typically CMake) and want to use MS Visual Studio environment for just debugging. You don't need to create msvc project for your KDE application to be able to start debugging.
If you have your application is already running, you can attach to it and then start debugging.
You can create a macro that automates the task. See [2].
If you are using the debug heap, memory is initialized and cleared with special values. Most interesting values are:
See also: [3]
You'll probably want to avoind stepping into lower-level functions like QString constructors or operators while debugging step-by-step. Here's the detailed (unofficial) instruction for various msvc versions.
From the msvc docs: "While debugging, Data Tips and items in the Watch and Variable windows are automatically expanded to show their most important elements. The expansion follows the format given by the rules in this file. You can add rules for your types or change the predefined rules." (example screen)
MSVC 2005: To add support for expanding Qt data structures like QString of QRect, edit {msvc_installation_directory}\Common7\Packages\Debugger\autoexp.dat file and paste definitions after [AutoExpand] line.
CONSOLE subsystem is the one that displays console window (used for standard output and error streams) in addition to application's windows. WINDOWS subsystem redirects standard output and error streams to system debugging subsystem that can be displayed if needed in dbgview or debuggers like msvc.
Hint: To remove CONSOLE subsystem from already built .exe file, type editbin /subsystem:windows file.exe
Note: Qt's qmake syntax supports console and windows parameters of the CONFIG variable, so CONSOLE subsystem can be enabled by specifying CONFIG += console in the .pro file, windows subsystem can be enabled with CONFIG += windows.
Running a VC++2005 SP1 app on another computer: manifest files are needed. See [4] and [5].
The hints above are for release builds (or ReleaseWithDebugInfo). Moving Debug versions of binaries to other computers is only allowed (and technicallu possible) if you have Express Edition installed there, as there is no redistributable package for Debug versions provided and even the license disallows distribution of any debug binaries (even your own).
WARNING: If you are having crashes when starting applications via gdb beware of certain applications (mostly anti-virus software) that could cause problems like "Embassy Trust Suite", for example. See this post.