CE6.0 DumpMem not working and how to fix



Recently I experienced an old "cclib.lub" issue in CE6.0.

I was investigating ASYNCMAC.dll by debug build / kernel debugger and
enabled ZONE_RECV to print PPP packets ASYNCMAC handle. Then, I saw
the message like follows:

146564 PID:400002 TID:5f5000e Mac: RecvPacket size now 0 bytes,
pCurr=d1e30250
146564 PID:400002 TID:5f5000e AsyncMac: WaitCommEvent...
146569 PID:400002 TID:5f5000e AsyncMac: ...WaitCommEvent returned:
Mask=0x1
146569 PID:400002 TID:5f5000e AsyncMac:RX avail
146569 PID:400002 TID:5f5000e ->mac:RX 55 bytes, spaceLeft=1556
pCurr=d1e30250
146569 PID:400002 TID:5f5000e
AsyncMac ReadFile:
148117 PID:400002 TID:5f5000e 0000
148127 PID:400002 TID:5f5000e 0010
148127 PID:400002 TID:5f5000e 0020
148127 PID:400002 TID:5f5000e 0030
148127 PID:400002 TID:5f5000e

This should be generated by the debug support codes in CE6 asyncmac
but no dump data appeared.
The code is:

[\WINCE600\public\common\oak\drivers\netsamp\asyncmac\recv.c]

DEBUGMSG(ZONE_RECV, (TEXT("->mac:RX %d bytes, spaceLeft=%d pCurr=%x
\n" ), cbReceiveData, pRecvPacketEnd - pRecvPacketCurrent,
pRecvPacketCurrent));
#ifdef DEBUG
if (ZONE_RECV)
{
DEBUGMSG(1, (TEXT("\nAsyncMac ReadFile:\n")));
DumpMem(pbReceiveData, cbReceiveData);
DEBUGMSG(1, (TEXT("\n\n")));
}
#endif


Then I traced and found the "DumpMem" code exists in the
WINCE600\PRIVATE tree.

[\WINCE600\private\winceos\COMM\cclib\ccutil.cpp]

void DumpMemWithPrefixViaFunction (void const * const p, const size_t
Len, WCHAR const* const Prefix, const size_t cchPrefix, const
PFN_PRINT_LINE printLine)
{
BYTE const * const Ptr = reinterpret_cast<BYTE const * const>(p);
ULONG i,j;
WCHAR OutString[128];
int Index;

for (j=0; j < Len; j+= 16) {
Index = 0;

// Print out a leader
StringCchPrintfW(OutString, 5, L"%04X ", j);

=====================================

Because StringCchPrintfW requires the number of buffer size (by wide
char unit), including the last wide NULL character, the 2nd argument
should be 6.

Then I quickly build the cclib.lib and build debug version of
ASYNCMAC.dll by following

- In VS2005, select "<BSP name> debug" configuration
- You shoud at least build one time (to generate sysgen headers etc)
- In VS2005, start "Build" menu, "Open Release Directry in Build
Window"
- navigate to \WINCE600\private\winceos\COMM\cclib\ folder
- create backup of ccutil.cpp and edit.

* at this point, WINCEDEBUG should be "debug" or "retail", and
WINCEREL=1 must be set

- perform "build -c"
- perform "sysgen asyncmac"
- from VS2005, start "Build" menu, "Make runtime Image"


At this point, I found there's one header file "sha.h" NOT provided in
build tree. But I supporse this is not needed for building debug
version of ASYNCMAC then I comment out the "sha.h" related things.

=====================================

// disabled because we have no "sha.h" provided
//#include <sha.h>

..
..
..

//#ifdef UNDER_CE
// disabled because we have no "sha.h" provided
#if 0

=====================================


This may effect when you builld other OS images so please make backup
copies of \WINCE600\public\common\oak\lib\<cpu type>\debug\cclib.*

Finally I got the ASYNCMAC output of following:

168438 PID:400002 TID:4cf000e Mac: RecvPacket size now 0 bytes,
pCurr=d08fe6c0
168438 PID:400002 TID:4cf000e AsyncMac: WaitCommEvent...
168441 PID:400002 TID:4cf000e AsyncMac: ...WaitCommEvent returned:
Mask=0x1
168441 PID:400002 TID:4cf000e AsyncMac:RX avail
168441 PID:400002 TID:4cf000e ->mac:RX 54 bytes, spaceLeft=1556
pCurr=d08fe6c0
168441 PID:400002 TID:4cf000e
AsyncMac ReadFile:
168441 PID:400002 TID:4cf000e 0000 7E FF 7D 23 C0 21 7D 21-7D 20 7D
20 7D 39 7D 22 ~.}#.!}!} } }9}"
168441 PID:400002 TID:4cf000e 0010 7D 26 7D 20 7D 20 7D 20-7D 20 7D
23 7D 25 C2 23 }&} } } } }#}%.#
168441 PID:400002 TID:4cf000e 0020 7D 25 7D 25 7D 26 7D 20-D9 E1 D6
7D 27 7D 22 7D }%}%}&} ...}'}"}
168441 PID:400002 TID:4cf000e 0030 28 7D 22 B6 F9 7E
- (}"..~
168441 PID:400002 TID:4cf000e


Hope this will help somebody.
.



Relevant Pages

  • Re: If Statement Variations
    ... Last night I saw a set of codes from that I understand #Const is turned off ... It is used with #If Debug_ then.... ... the & character forces the compiler to use a Long ... overflow a short Integer. ...
    (microsoft.public.excel.programming)
  • Right Click context menu sometimes disables "Go To Definition" using VSl.NET 2005
    ... reason as to when I can go to the definition or declaration of a routine ... CRRDoc::Dumpconst ... When I stop at a breakpoint (usiing the Debug build) inside the ...
    (microsoft.public.vc.language)
  • Re: If Statement Variations
    ... Constants defined by a #Const statement can only be seen by a #If statement block and not by normal code. ... and then try to use this in normal code, you won't see the assigned value. ... If CompilerConstant = 123 Then ... It is used with #If Debug_ then.... ...
    (microsoft.public.excel.programming)
  • Re: Exchange Agent not running
    ... Const EVT_INVALID_URL = &H40000000 ... ' Debug file path, change it to the location you want to store ... Dim objFileSystem ' As Scripting.FileSystemObject ... Dim objFile ' As Scripting.TextStream ...
    (microsoft.public.exchange2000.development)
  • Re: Exchange Agent not running
    ... Const EVT_INVALID_URL = &H40000000 ... ' Debug file path, change it to the location you want to store ... Dim objFileSystem ' As Scripting.FileSystemObject ... Dim objFile ' As Scripting.TextStream ...
    (microsoft.public.exchange.development)