- 在 kitl enable 情況下 不需將system 停止 ,可控制想要列印的 debug information
- Debug Zone 可以說是 define name 再加上 debug message output status (on/off)
- 每個module 有16個 debug zones
- 需 include DbgApi.h
- 宣告 DBGPARAM Structure ,必須被 dbCurSettings 呼叫
EX:
#ifdef DEBUG
#define DEFAULT_ZONES 0x11 // init & error
#define ZONE_INIT DEBUGZONE(0)
#define ZONE_FUNCTION DEBUGZONE(1)
#define ZONE_TRACE DEBUGZONE(2)
#define ZONE_WARN DEBUGZONE(3)
#define ZONE_ERROR DEBUGZONE(4)
DBGPARAM dpCurSettings =
{
TEXT("Backlight"),
{ TEXT("Init"), TEXT("Function"),
TEXT("Trace"), TEXT("Warn"),
TEXT("Error"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined") },
DEFAULT_ZONES
};
#endif
DEFAULT_ZONES : 預設開啟的Debug Message,用16Bit 表示,每bit 代表
dpCurSettings array index item enable or disable
EX: 0x3 表示開啟 TEXT("Init") TEXT("Function")
Registering Debug Zones
BOOL WINAPI
BAK_DllEntry(HINSTANCE DllInstance, INT Reason, LPVOID Reserved)
{
switch(Reason) {
case DLL_PROCESS_ATTACH:
DEBUGMSG(ZONE_TRACE, (TEXT("BAK_DllEntry: DLL_PROCESS_ATTACH\r\n")));
DEBUGREGISTER(DllInstance);
// load external DLL if necessary
break;
case DLL_PROCESS_DETACH:
DEBUGMSG(ZONE_TRACE, (TEXT("BAK_DllEntry: DLL_PROCESS_DETACH\r\n")));
// free stuff here
break;
}
// return TRUE for success, FALSE for failure
return TRUE;
}
- Detail in :
http://msdn2.microsoft.com/en-us/library/aa935747.aspx
http://blogs.msdn.com/ce_base/archive/2006/12/18/debug-messages-and-debug-zones-in-windows-ce.aspx
沒有留言:
張貼留言