怎样使用 RDebug

How to use RDebug

From Forum Nokia Wiki

Jump to: navigation, search

Contents

  • 1 General
  • 2 RDebug::Print format
  • 3 Enabling RDebug output in the emulator
  • 4 Viewing RDebug output in Carbide.c++
  • 5 Viewing RDebug output in CodeWarrior
  • 6 Viewing RDebug output outside of an IDE
  • 7 Capturing RDebug output in epocwind.out
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>

[edit] 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.

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!!!


[edit] 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 );

 

[edit] 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


[edit] 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‎


[edit] Viewing RDebug output in CodeWarrior

[edit] 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 occiasionally 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.


[edit] 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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值