How to Use rdebug

Source: Internet
Author: User
Tags print format
General

RdebugIs a useful utility for checking a log of specific messages generated by the Running code. This feature is helpful when the breakpoint/step debug tricks 'using space has been limited.

To useRdebug, Include the header file,E32debug. h. (In 2nd Edition SDK, rdebug class declared in
E32svr. h)

#include <e32debug.h>

Then, add the following to any place in your code:

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

The output debug message is now viewable with
DebugviewTool.

This trick is especially useful for tasks with special requirements.

Rdebug: print format

TheRdebug: PrintParameter format is easy because it follows the C
PrintfFormat. The one that most have trouble with is % s to print a descriptor. It expects a pointer to a descriptor, so you must use
&Operator if you are printingTbuf, For example.

// Print a HBufCRDebug::Print( _L("Test string: %S"), hbuf ); // Print a TBufRDebug::Print( _L("Test string: %S"), &tbuf );   //  useful macro, LINE , evaluates to the current line number in     RDebug::Print(_L("Debug on line %d"), __LINE__);

Enabling rdebug output in the emulator

The outputRdebugIn emulator is written:

  • A text file, calledEpocwind. Out. The file is located in the temp folder. If you do not know the location of your temp folder, Check Control Panel | Settings | advanced | environment variables.
  • Debugger view of the IDE (see the following sections ).

For s60 3rd edition, there are two options in/Epoc32/data/EPOC. iniFile to enable or disable
RdebugOutput, that is:

  • Logtofile
  • Logtodebugger

The following code shows the contentEPOC. iniWithLogtofileAnd
LogtodebuggerEnabled:

LogToFile 1LogToDebugger 1

Note:If changing the EPOC. INI is something that you feel comfortable with, then try it. you can also control the same settings through the emulator's window menu. select Tools-> preferences. the logging options can be found in the general
Tab.

Viewing rdebug output in carbide. c ++

ViewingRdebugOutput 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 ).

After the "view process output" option has been enabled, debug the project. to display the debug messages, click Open console and select the debug messages menu. The picture below shows the output
RdebugIn the carbide. c ++ IDE.

Viewing rdebug output in carbide. c ++ (advanced)

Carbide. c ++ is an eclipse based ide. The advantage of this is that your existing Eclipse plug-ins can be easily integrated with carbide. c ++. One such example is

Eclipse logfile ViewerPlug-in, a tool that can dynamically load a log file, parse it according to user defined rules, and then display it in real time with customised formatting.

Plug-in configuration example:

Viewing the rdebug messages:

Here you can see how the plug-in can be used to highlight the log messages sent by your application, recognized as starting with the keyword
Rdebug.

RDebug::Print( _L("RDebug Hello") );

Viewing rdebug output outside of an ide

It is also possible to view debug output without any IDE or Debugger Attached. this can speed up launch times for the emulator (for example, 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
DebugviewFrom Microsoft. debugview also has additional features such as highlighting or excluding strings with a particle pattern.

One thing to keep in mind is that the debug output can occasionally come from other processes in your system, not just the Symbian emulator, so with a tool like debugview you can 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. OutIs 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

TailFreeware program. It is a port of the UNIX tail program that prints the "tail" of a file.

Create a BAT file as follows:

tail -f %temp%/epocwind.out

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

Retrieved from" Http://wiki.forum.nokia.com/index.php/How_to_use_RDebug"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.