How to drop a (Microsoft Generated) debug DLL into a Windows CE device?

Sometimes on the newsgroups I tell an OEM that’s having problems with some component to “Drop DEBUG DLL foo into the release directory and turn on full DEBUGOUT and get me the output.”  Most Windows CE components have pretty good debug-time logging so a lot of times a customer can see the exact cause of the problem spit out in DEBUGOUT.

<Note this is for Windows CE Platform Builder (PB) developers only, not Windows Mobile (unless you’re an OEM building a Windows Mobile device).  Also my article is in particular about components that Microsoft delivers in both DEBUG and retail form, no code that you build yourself.  For more info on that, check out the comments from Fernando’s feedback below.>

But how do you get this DEBUG DLL and its output?  RETAIL DLLs don’t have this, of course.  The easiest way is if you can build a fully DEBUG version of the OS and boot it while connected to Platform Builder, then you’re pretty much done.  Just turn on appropriate debug zones for the component you need.  This is recommended since it’s one less step.

However there are scenario where you not have enough RAM/ROM to take a fully DEBUG OS.  In this case you want to just drop on the DEBUG dll that you’re interested in but have everything else be RETAIL.  To do this:

1) Build the complete platform for both DEBUG and RETAIL OS.

2) Open RETAIL project in PB, then open a build window. In CE 6.0 this is Tools->Open Release directory in Build Window, menu and wording may be slightly different in different versions.

3) This will put you into the release directory for the RETAIL build.  The release directory is just the dir where all your intermediate DLLs/PDBs/etc get dumped prior to creating a ROM image.  Create a new directory here, ORG, and copy ModuleYouWantDebugOutFor.* to ORG.

4) If you “cd ..”, the DEBUG directory will also be present.  (I’m assuming you haven’t customized releasedir position in anyway).  copy ..\<debugDir>\ModuleYouWantDebugOutFor.* to RETAIL releasedirectory.

5) Now in PB, run Build->Make Run-Time Image.  (Again, wording may change slightly across releases.)  This automatically puts the DLL you want DEBUG into the ROM image.

6) Before you ship this ROM image to the world you need to remove the DEBUG bits from it.  Ideally you have a formal build process of generating DLLs from a “clean” source, not developer’s machine, but in case you don’t be aware of this issue.

Note that not all CE Components have DEBUG messages, but most do.

Happy debugging!

[Author: John Spaith]

Comments (2)

  1. fegonzal says:

    You can build debug in a RETAIL build window: set COMPILE_DEBUG=1 in the build window, then rebuild your component.

    You can also set the variable in your sources file, so the component will always be debug, even after a blddemo.

    I haven’t built a complete debug image in a long time 🙂

  2. cenet says:

    Thanks for the feedback, this is useful for folks building their own sources.  My article was intended for people bringing in DEBUG components of MS components that they don’t have source to or at a minimum don’t want to rebuild, but on re-reading it my intentions weren’t clear.  I’m modifying the article so that it is clear.