Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 19:03, 28 May 2008.

How to use RDebug

From Forum Nokia Wiki


Contents

General

RDebug is a utility that is very useful when we want to check a log of specific messages which the running code generates. This feature will help a lot when we have limited breakpoint/step debug tricks' using space.

To use RDebug, include the header file, e32debug.h.

#include <e32debug.h>

Then, in any place of your code, just put:

// code before log
RDebug::Print(_L("### Log %d %08x"), 5, 0xABCDEF12);
// code after log

and then with a tool called DebugView we could see the output debug message.

This trick is especially useful for tasks with special requirements. Enjoy this while debugging!!!


RDebug::Print format

RDebug::Print parameter format is easy because it follows the C printf format. The one that most have trouble with is %S to print a descriptor. The "trick" is that it expects a pointer to a descriptor so you must use the & operator if you are printing a TBuf for example.

// Print a HBufC
RDebug::Print( _L("Test string: %S"), hbuf );
 
// Print a TBuf
RDebug::Print( _L("Test string: %S"), &tbuf );

Enabling RDebug output in the emulator

The output of RDebug in emulator is written to:

  • Text file, called EPOCWIND.OUT. The file is located in the TEMP folder. If you don't know the location of your TEMP folder, check Control Panel | Settings | Advanced | Environment Variables.
  • Debugger view of the IDE (see next sections).


For S60 3rd Edition, there are two option in the \epoc32\data\epoc.ini file to enable or disable RDebug output, i.e.:

  • LogToFile
  • LogToDebugger

The following code shows the content of epoc.ini with LogToFile and LogToDebugger enabled.

LogToFile 1
LogToDebugger 1


Viewing RDebug output in Carbide.c++

Viewing RDebug output in the Carbide.c++ IDE can be done by enabling "View process output". To enable it, right click project name and select Debug as | Debug.... Click the Debugger tab and enable "View process output" (see picture below).

Image:Rdebug_in_carbide.jpg

After the "View process output" option has been enabled, debug the project. To display the debug messages, click Open Console button and select Debug Messages menu. The picture below shows the output of RDebug in the Carbide.c++ IDE.

Image:Debug_view_in_carbide.jpg‎


Viewing RDebug output in CodeWarrior

Viewing RDebug output outside of an IDE

It is also possible to look at debug output without any IDE or debugger attached at all, which may speed up launch times for the emulator (e.g. if you are using Just-in-time debugging as described in How to debug with emulator on the fly).

For this, you can use several tools that show Windows debug strings, such as DebugView from Microsoft. DebugView also lets you do "fancy" things such as highlighting or excluding strings with a particular pattern.

One thing to keep in mind is that debug output may occasionally come from other processes in your system, not just the Symbian emulator, so with a tool like DebugView you may capture other strings not related to the application you are debugging. Again, filtering can be very helpful here.


Capturing RDebug output in epocwind.out

epocwind.out is just a normal text file which is appended by the emulator so you can open it with any text editor. To be able to see the log prints as they come, you can use the tail freeware program. It is just a port of the unix tail program that prints the "tail" of a file. Just create a bat file like so:

tail -f %temp%\epocwind.out

It opens a dos-prompt to show the log prints as they come. It can be closed by pressing ctrl-C.

Related Discussions
Thread Thread Starter Forum Replies Last Post
data via Pop Port? mseeman General Symbian C++ 6 2006-03-19 17:36
Problem with SIP Resolver Ecom Plugin ecio83 Symbian Networking & Messaging 8 2007-07-30 09:04
LOGMSG Deepa msc General Symbian C++ 1 2007-12-20 13:54
remote debugging on communicator 9210 randoux General Symbian C++ 1 2002-07-19 10:03
Nokia N80 crashes and reboots. ddskani General Symbian C++ 1 2006-10-15 11:57
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX