Debug zones in WinCE

Source: Internet
Author: User

WinCEIt supports the concept of DEBUG zone. In short, the so-called debug zone is a mechanism to control the output of debugging information of different levels. When developing applications, we usually use plug-ins to debug the code by using functions such as outputdebugstring and debugmsg and macro output debugging information, however, although a large amount of debugging information facilitates debugging, it is often difficult to view the debugging information, because hundreds of thousands of debugging information may be output within one second, and there is no way to view it in time.

The debug zone is designed to solve this problem. We can define a series of DEBUG zones. when inserting a column in the code, we can specify the zone of the Information. Only when the zone is enabled, the debugging information of this zone is output. Through control, different debug zones can be used to output only debugging information that we are interested in.

How to use DEBUG zones?

1. First define the debug zones you support and the corresponding bitmask. To put it bluntly, define a series of constants, each representing a zone. Example:

# Define zoneid_init 0

# Define zoneid_second 1

# Define zoneid_0000t 2

.

.

.

# Define zoneid_error 15

The corresponding bitmask is defined below:

# Define zonemask_init (1 <zoneid_init)

# Define zonemask_second (1 <zoneid_second)

# Define zonemask_except (1 <zoneid_except)

.

.

.

# Define zonemask_error (1 <zoneid_error)

The above work is usually done in the header file.

2. define a global variable dpcursettings for the dbgparam structure. This structure includes information about the debug zone, such:

Dbgparam dpcursettings = {

Text ("dbgsamp1 "),{

Text ("init"), text ("seconds"), text ("except"), text (""),

Text (""), text (""),

(""), Text (""),

Text (""), text (""), text ("Warnings"), text ("errors ")},

Zonemask_error | zonemask_init

};

The first variable Text ("dbgsamp1") represents the name of the module or application. This name should correspond to the debug zone initialization item in the registry of the Development host (not the target machine. 2nd variables: Text ("init"), text ("seconds"), text ("t"), text (""), text (""), text (""), text (""), text (""), text ("Warnings"), text ("errors")}, representing the names of 16 zones, you can specify this name for ease of reading. And the order should be strictly arranged from the first zone to the 16th zones, that is, the first text ("init") corresponds to the name of zoneid_init; 3rd variables zonemask_error | zonemask_init specifies the zone enabled by default when startup. For example, if 3rd variables are set to 0x8001, 16th and 1st zones are enabled, others are disabled.

 

3. register the dbgparam structure so that the system's debugging subsystem can identify your defined debug zone. There are two ways to register: use the registry, and use the debugregister or retailregisterzone macro.

4. Now you can use the debug zone. Use the debug macro (such as retailmsg, debugmsg, and debugregister) in the code to add debugging information and specify the corresponding debug zone in these macros.

 

How to view and change debug zones?

Select ce debug zones from the target menu of platform. Builder. A dialog box is displayed.

Select the debug zone of the module/program you want to change in the list on the left, select the zone you want to enable in the list on the right, and click OK.

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.