<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">John Eldridge : Windows CE Debugging</title><subtitle type="html">KITL First. Ask Questions Later.</subtitle><id>http://blogs.msdn.com/kitlfirst/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/kitlfirst/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2005-01-29T00:08:00Z</updated><entry><title>MEDC 2006</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2006/03/30/564409.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2006/03/30/564409.aspx</id><published>2006-03-30T03:23:00Z</published><updated>2006-03-30T03:23:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Georgia&gt;Just FYI, I plan to be at MEDC in Vegas for pretty much the entire event. If you'd like to speak with me in person I will be staffing at the "Ask The Experts" sessions as well as participating in some panel sessions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia&gt;Have a look at &lt;/FONT&gt;&lt;A href="http://www.medc2006.com"&gt;&lt;FONT face=Georgia&gt;http://www.medc2006.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Georgia&gt; for details on the developer conference, and see you in Vegas!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia&gt;-John.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=564409" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Comments on my site</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2006/03/30/564403.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2006/03/30/564403.aspx</id><published>2006-03-30T03:15:00Z</published><updated>2006-03-30T03:15:00Z</updated><content type="html">Ug. Sorry, folks. I just noticed that some comments to my blog posts weren't being published automatically. I was not intentionally filtering. Hopefully I have it set correctly now.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=564403" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Virtual Memory and Thread Stacks</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2006/01/31/520197.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2006/01/31/520197.aspx</id><published>2006-01-31T08:44:00Z</published><updated>2006-01-31T08:44:00Z</updated><content type="html">&lt;p&gt;&lt;font face=Georgia&gt;I know. It's been nearly a year since I posted anything. Ouch. Bad John.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Georgia&gt;What inspires a new post? Virtual memory. One of my favorite subjects, but unfortunately, also a common stumbling block on Windows CE, especially on feature-rich Pocket PCs. I've been debugging several stress cases recently that were impacted by virtual memory pressures and I thought I should remind folks about one common source of unnecessary pain.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Georgia&gt;When you build applications within Platform Builder or the Windows Mobile Adaptation Kit, the default thread stack is 64kB of reserved virtual memory (the physical RAM is committed one page at a time). This is a pretty reasonable limit for most things on an embedded device. However, when you build your applications in Visual Studio, the default thread stack is 1MB of reserved virtual memory. This is often much more than needed and consumes precious virtual memory real estate. Windows CE processes are limited to 32 MB of virtual address space, unless you employ specific techniques to allocate larger blocks outside the process space. If your application only has one or two threads this may not be a big deal, but if your app is heavily multi-threaded, you can very quickly run out of virtual address space on a CE-based device.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Georgia&gt;The better option is to set the default stack within the VS options back to 64k (see photo) and then allocate larger stacks only if necessary. The way to create a thread with a larger than default stack on Windows CE is to call CreateThread with the STACK_SIZE_PARAM_IS_A_RESERVATION set in dwCreationFlags and dwStackSize set to how large you would like your stack to be. That value will be rounded up to the next 64kB boundary. The physical RAM will still be committed just a page at a time as needed.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=Georgia&gt;I'd personally like to change the VS default to a much smaller value, but that could introduce unexpected backwards-compatibility issues for folks that couldn't be caught at build time. I'm curious to hear feedback though of whether anyone targeting CE-based devices in Visual Studio is relying on the 1MB default? Or if you are changing the stack sizes already? Or just don't care since your apps only have a couple threads anyway?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/photos/kitlfirst/images/520224/original.aspx" border=0/&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=520197" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Platform Builder Debug Symbols : Are They Correct??</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2005/02/22/377629.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2005/02/22/377629.aspx</id><published>2005-02-22T15:05:00Z</published><updated>2005-02-22T15:05:00Z</updated><content type="html">&lt;html&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content="text/html; charset=us-ascii"&gt;
&lt;meta name=Generator content="Microsoft Word 11 (filtered)"&gt;
&lt;title&gt;PB Symbols&lt;/title&gt;
&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Batang;
	panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:"\@Batang";
	panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:Georgia;
	panose-1:2 4 5 2 5 4 5 2 3 3;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
@page Section1
	{size:11.0in 8.5in;
	margin:1.25in 1.0in 1.25in 1.0in;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;

&lt;/head&gt;

&lt;body lang=EN-US&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;On Platform Builder versions prior to 5.0, one thing
I find myself doing in a lot of debugging cases is verifying that debugger
symbols match what is actually running on a device. In most cases the debugger
can detect incorrect symbols and will notify the user in two ways. &lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;The first
notification comes when the module loads. There will be a notification in the
debug output window that says something like &amp;#8220;no matching symbols
found&amp;#8221;. For instance, here&amp;#8217;s an example of loading OSSVCS.DLL when
the PDB is missing from the release directory.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia'&gt;Debug Output Window&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;Loaded '&amp;lt;path&amp;gt;\OSSVCS.DLL', no
matching symbolic information found.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;The
second way to see status is to look in the modules and symbols window in
Platform Builder. It will show the symbol load status and where the symbols
have been loaded from.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-indent:6.0pt'&gt;&lt;span style='font-size:10.0pt;
font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Modules and Symbols Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;oleaut32.dll&amp;nbsp;&amp;nbsp;&amp;nbsp;
0x037D0000 - 0x037FFFFF&amp;nbsp; 0x01F3E000 - 0x01F3EED0&amp;nbsp; Loaded&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;ossvcs.dll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
0x033F0000 - 0x0341BFFF&amp;nbsp; 0x01EFB000 - 0x01EFB9B0&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span
style='font-size:8.0pt;font-family:"Courier New";color:blue'&gt;Unloaded&lt;/span&gt;&lt;/b&gt;&lt;span
style='font-size:8.0pt;font-family:"Courier New";color:maroon'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='text-indent:6.0pt'&gt;&lt;span style='font-size:10.0pt;
font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Unfortunately,
there are cases where this isn&amp;#8217;t enough. The Windows CE tools format
modules in the MODULES section of the BIB to strip out any information that is
not necessary to run the module.&amp;nbsp; In doing so, the original file format is
not maintained and it&amp;#8217;s possible for the code resident on the device to
not match the symbols that the debugger loads. The most common case of this is
when you receive a .BIN file from someone without the matching symbols. The
second common case can happen if you regenerate a module, updating it in the
release directory, without updating it on the device. In this case the DLL and
PDB in the release directory match each other, but don&amp;#8217;t match
what&amp;#8217;s running on the device.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Mismatched
symbols can lead to a poor or misleading debugging experience. One method I use
to manually verify the symbols is to look at the start of a few functions from
the module I&amp;#8217;m working with.&amp;nbsp; Pick a function and find out what
address it&amp;#8217;s loaded at by typing the module and function name into the
watch window, as follows&amp;#8230;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Watch Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;{,,ossvcs.dll} PlaySoundScript&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;This
should resolve to a specific address like this&amp;#8230;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Watch Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;{,,ossvcs.dll}
PlaySoundScript&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;0x033f895c PlaySoundScript(&amp;#8230;)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;If it
doesn&amp;#8217;t, you may not have symbols at all, in which case you may need to
regenerate or get the symbols from whoever built the module originally.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Now that
you have the function address, &lt;b&gt;click&lt;/b&gt; on the result and &lt;b&gt;drag&lt;/b&gt; the
contents to the disassembly window. The assembly code for this function should
appear. This is the code that is being read from the device at this address. If
the symbols match, then you should see something like this&amp;#8230;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Disassembly Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;PlaySoundScript&lt;/span&gt;&lt;/b&gt;&lt;span
style='font-size:8.0pt;font-family:"Courier New";color:maroon'&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;033F895C
E92D4010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;stmdb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp!, {r4, lr}&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;033F8960
E24DD004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;sub&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp, sp, #4&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;$M36115:&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;033F8964
E3A04000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
mov&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r4, #0&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;&amp;#8230;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;How can
you tell if this is correct? Well, you need to know generally what a function
entry looks like; let me explain that here. I&amp;#8217;m going to show example
from ARM assembly, but other processors have similar entry methods. The
compiler generates a prolog on function entry.&amp;nbsp;&amp;nbsp; A prolog is a
handful of machine instructions that prepare the processor to execute a new
function. In most cases this is simply to push a set of registers onto the
stack and to decrement the stack pointer by enough to allow room for local
function variables to live on the stack if necessary. &lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;For
instance, the most common first instruction on ARM processor for a function
entry point is a &amp;#8216;store multiple&amp;#8217; instruction, here saving R4 and
LR onto the stack.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Disassembly Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;PlaySoundScript&lt;/span&gt;&lt;/b&gt;&lt;span
style='font-size:8.0pt;font-family:"Courier New";color:maroon'&gt;:&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;033F895C
E92D4010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;stmdb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp!, {r4, lr}&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Now
here&amp;#8217;s an example of a case of &lt;b&gt;symbol mismatch&lt;/b&gt; where the debugger
could not detect the mismatch on module load.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Disassembly Window &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;SetPolicy:&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0340863C
E8BD8030&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;ldmia&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp!, {r4, r5, pc}&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;03408640
033F19A4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
???&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;$M30427:&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;03408644
033F2A00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
???&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;03408648
E92D40F0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;b&gt;stmdb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp!, {r4 - r7, lr}&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0340864C
E24DD01C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
sub&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp, sp, #0x1C&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;In this
case, I had updated the module in the release directory, but was running an
older binary image in the device. Here you see that there is not &amp;#8216;store
multiple&amp;#8217; instruction at the beginning. Instead the &amp;#8216;store
multiple&amp;#8217; is a few assembly instructions down because of the symbol
mismatch.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Mismatched
symbols can affect your debugging experience, even if you are not specifically
looking at an issue that directly involves the mismatched module. For instance,
here&amp;#8217;s a call stack for a thread from a Windows Mobile device with &lt;b&gt;correct
symbols&lt;/b&gt;: &lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Callstack Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfdbc NK!SC_WaitForMultiple()
schedule.c line 4434 + 20 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfde8 NK!UB_WaitForMultiple()
schedule.c line 4483&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe00 COREDLL!xxx_WaitForMultipleObjects()
tkfuncs.c line 101 + 52 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe18
GWES!MsgQueue::MsgWaitForMultipleObjectsEx_I() msgque.cpp line 5296 + 16 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe64
COREDLL!xxx_MsgWaitForMultipleObjectsEx() twinuser.cpp line 1205&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe70 &lt;b&gt;OSSVCS!SSUpdate::Thread()
ssupdate.cpp line 1444&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfed4 COREDLL!ThreadBaseFunc()
apis.c line 419&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;Here&amp;#8217;s
that same exact call stack if I manually unload the symbols and put &lt;b&gt;wrong
symbols&lt;/b&gt; for OSSVCS.DLL into the release directory. &lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;b&gt;&lt;span style='font-size:9.0pt;
font-family:Georgia;color:black'&gt;Callstack Window&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfdbc NK!SC_WaitForMultiple()
schedule.c line 4434 + 20 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfde8 NK!UB_WaitForMultiple()
schedule.c line 4483&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe00
COREDLL!xxx_WaitForMultipleObjects() tkfuncs.c line 101 + 52 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe18
GWES!MsgQueue::MsgWaitForMultipleObjectsEx_I() msgque.cpp line 5296 + 16 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe64
COREDLL!xxx_MsgWaitForMultipleObjectsEx() twinuser.cpp line 1205&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe70 &lt;b&gt;OSSVCS!SSUpdate::s_WndProc()
ssupdate.cpp line 1543 + 4 bytes&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe70 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfe88 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfea0 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfeb8 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfed0 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;0x0c0bfee8 NK!PrefetchAbort + 336 bytes&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal style='margin-left:.5in'&gt;&lt;span style='font-size:8.0pt;
font-family:"Courier New";color:maroon'&gt;&amp;#8230;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;The
debugger tries to unwind the call stack. When it unwinds to a function in OSSVCS.DLL,
it looks for the prolog in order to fix up the stack. But because the prolog
isn&amp;#8217;t at the right address, the debugger miscalculates where to find the
next function on the callstack and ends up showing garbage.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;The
bottom line:&amp;nbsp; It is critical to have the correct symbols to effectively
use the debugger.&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;font-family:Georgia'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=377629" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author><category term="" scheme="http://blogs.msdn.com/kitlfirst/archive/tags//default.aspx" /></entry><entry><title>Controlling PB docking windows</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2005/01/31/363491.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2005/01/31/363491.aspx</id><published>2005-01-31T17:20:00Z</published><updated>2005-01-31T17:20:00Z</updated><content type="html">&lt;font face="Georgia" size="2"&gt;Minor tip here, but I know I was thrilled the first time I learned it. The docking windows view used to really annoy me because of the way they'd decide to position themselves as I'd drag the window.&amp;nbsp; Well, you can just hold CTRL key while dragging to leave it unattached but placement is in your control.&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=363491" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Finding functions in watch window</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362524.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362524.aspx</id><published>2005-01-29T10:20:00Z</published><updated>2005-01-29T10:20:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Georgia" size="2"&gt;One of the elements of the Windows CE debugger that I use everyday, but have found to be not that well-known, is the ability to look at global variables and functions in any named DLL or EXE. Doesn't have to be in the currently stopped location. For instance, break into the debugger, and add a watch in the watch window named...&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {,,coredll.dll} LocalAlloc&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;This says to resolve the name "LocalAlloc" in the context of the module "COREDLL.DLL". You should see something like...&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x03f9a4f4 LocalAlloc(unsigned int, unsigned int)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Georgia"&gt;Which means that the LocalAlloc() function lives at 0x03f9a4f4.&amp;nbsp; That alone has limited usefulness. But now the &lt;strong&gt;really cool&lt;/strong&gt; part... click on the result (Value Column) and drag it into the disassembly window.&amp;nbsp; Now the disassembly window shows the assembly for the LocalAlloc function.&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Georgia"&gt;Want the source instead? Now right-click in the disassembly window and choose "Go To Source". If you didn't compile the code yourself for the function you are looking at, it may ask you to input the path. I actually use this trick a lot just to let the debugger tell me where source code lives for certain functions that I'm not familiar with.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;font face="Georgia"&gt;Did I mention that you don't get this functionality without implementing KITL?&amp;nbsp;&amp;nbsp; :-) &lt;/font&gt;&lt;br /&gt;&lt;/p&gt;&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=362524" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Debugging in 1024x768... ouch.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362446.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362446.aspx</id><published>2005-01-29T08:27:00Z</published><updated>2005-01-29T08:27:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Georgia" size="2"&gt;So, I've recently been doing a lot of debugging with Platform Builder on my laptop and with mobile customers who debug on laptops.&amp;nbsp; Sadly, the beautifully light, portable&amp;nbsp;laptops are often XGA resolution. Not a big deal, until you try to see Debug Output, Watch Window, Disassembly, Target Control, Registers, Callstack, etc all at the same time. Then it gets really tight.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;Well, the thing that strikes me the most is going to another person's laptop which is using the out-of-the-box PB font settings in XGA resolution. PB defaults to a nice "safe" font selection of, like, Terminal or Fixedsys or something hideous.&amp;nbsp;Ouch. Can barely fit one window, let alone 6.&amp;nbsp; But thankfully it's quick and easy to change under Tools | Options | Format (tab).&amp;nbsp; I run my laptop PB at 7-point Lucida Console for all windows. With ClearType enabled, it's very usable and beats swapping windows to the foreground all the time.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;That said, while on the road, I &lt;strong&gt;seriously&lt;/strong&gt; miss my dual-monitor setup back home. In my opinion, upping monitor real-estate is&amp;nbsp;a simple, easy way to increase debugging productivity.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=362446" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry><entry><title>Windows CE Debugging Tips : A random outlet</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362419.aspx" /><id>http://blogs.msdn.com/kitlfirst/archive/2005/01/29/362419.aspx</id><published>2005-01-29T08:08:00Z</published><updated>2005-01-29T08:08:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Georgia" size="2"&gt;Welcome. I've been thinking recently about all the random little tips and tricks I've learned over the years about debugging in Windows CE.&amp;nbsp; Well, I'm pretty bad about writing documentation that requires a good flow or consideration of a specific audience. So here I am, embarking on a experiment to see if I can do any better in just publishing my thoughts in free form blog format. That way, I can give&amp;nbsp;a little bit here and there as the mood strikes me without too much stress on format. With any luck someone will find the bits and pieces interesting and/or helpful. If it ends up being useful to you, please let me know.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;A little about myself first... my name is John Eldridge. I've been working for Microsoft since 1995, the whole time on Windows CE. I've spent most of my time in the lower layers, writing device drivers and kernel code. Currently I work mostly with OEMs doing debugging. For some strange reason, I find debugging software issues as one of the most rewarding elements of my job. Go figure.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;My motto (also this site's subtitle and my sign in name) is "KITL First. Ask Questions Later." If you are a Windows CE developer using Platform Builder and you don't know what KITL is or what it has to offer... go do it. Now. Don't even finish reading this. It will be well worth your investment. Seriously. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;Okay, you're still here, so you must know about KITL. I expect most of my future entries will assume that you have internalized its power. "Learn it. Love it. Live it." :-)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Georgia" size="2"&gt;Anyway, here's to "ENTRY 1".&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=362419" width="1" height="1"&gt;</content><author><name>kitlfirst</name><uri>http://blogs.msdn.com/members/kitlfirst.aspx</uri></author></entry></feed>