<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bramz' warehouse &#187; coding</title>
	<atom:link href="http://www.bramz.net/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bramz.net</link>
	<description>home page of Bram de Greve, aka Bramz: ramblings about programming, photography and other stuff.</description>
	<lastBuildDate>Wed, 28 Dec 2011 14:20:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>pycpuid 0.2</title>
		<link>http://www.bramz.net/2009/10/01/pycpuid-0-2/</link>
		<comments>http://www.bramz.net/2009/10/01/pycpuid-0-2/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 19:24:45 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.net/?p=532</guid>
		<description><![CDATA[It&#8217;s been more than two years since I&#8217;ve released the first version of my pycpuid module for Python. I haven&#8217;t been using it since, but as some people do, I decided to upgrade it a little. The result is pycpuid-0.2.0.zip. It&#8217;s still an unfinished work (I would like to add some more of the high [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been more than two years since I&#8217;ve released the first version of my <a href="http://www.bramz.net/projects-code/pycpuid/">pycpuid</a> module for <a href="http://python.org/">Python</a>.  I haven&#8217;t been using it since, but as some people do, I decided to upgrade it a little.  The result is <a href='http://www.bramz.net/wp-content/uploads/2007/05/pycpuid-0.2.0.zip' title='pycpuid-0-2-2.zip'>pycpuid-0.2.0.zip</a>.  It&#8217;s still an unfinished work (I would like to add some more of the high level functions), but as progress came to a standstill again, I&#8217;m releasing it as is.  Here&#8217;s the changelog:</p>
<ul>
<li>The feature abbreviations now resemble the ones in the <a href="http://www.intel.com/assets/pdf/appnote/241618.pdf">Intel</a> and <a href="http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf">AMD</a> documentation.</li>
<li><code>features()</code> is now a function and returns a list of strings, instead of being a comma separated string.</li>
<li>Added some functions like <code>vendor()</code> and <code>brand_string()</code> as handy wrappers.
<li><code>pycpuid</code> is now a combination of a pure python module <code>pycpuid.py</code> and an extension <code>_pycpuid.c</code>.  The extension module is only responsible for the actual <code>cpuid</code> call.  All the fancy wrapper bits are implemented in Python.</li>
<li>Added gcc support.  Using <code>__cpuid</code> intrinsic on MSVC to support x64.</li>
</ul>
<p>Share and Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2009/10/01/pycpuid-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>name hiding and the using-declaration</title>
		<link>http://www.bramz.net/2009/03/12/name-hiding-using-declaration/</link>
		<comments>http://www.bramz.net/2009/03/12/name-hiding-using-declaration/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 21:10:32 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.net/?p=316</guid>
		<description><![CDATA[This post is inspired by a question posed by a colleague some time ago. Consider following C++ code fragment in which B derives from A and declares a fun with a different signature: #include &#60;iostream> struct A { void fun(int x) { std::cout &#60;&#60; "int A\n"; } }; struct B: A { void fun(float x) [...]]]></description>
			<content:encoded><![CDATA[<p>This post is inspired by a question posed by a colleague some time ago.  Consider following C++ code fragment in which <code>B</code> derives from <code>A</code> and declares a <code>fun</code> with a different signature:</p>
<pre>#include &lt;iostream>

struct A
{
	void fun(int x) { std::cout &lt;&lt; "int A\n"; }
};

struct B: A
{
	void fun(float x) { std::cout &lt;&lt; "float B\n"; }
};

int main()
{
	B b;
	b.fun(3);
	return 0;
}</pre>
<p>What shall it print?  If your answer is <code>int A</code>, you&#8217;re probably assuming that the compiler will choose the best possible overload between <code>A::fun</code> and <code>B::fun</code>.  In that case however you&#8217;re ignoring an often overlooked rule called <em>name hiding</em>.  </p>
<p>The truth is that when you declare a function in a derived class, any function in the parent class that goes by the same name will be hidden from <code>B</code>&#8216;s interface.  From the C++ standard (C++ 98, 3.3.7 &sect; 1): <em>&#8220;A name can be hidden by an explicit declaration of that same name in a nested declarative region or derived class.&#8221;</em>  The consequence is that <code>A::fun</code> will never be considered as a possible overload, and only suitable function to call is <code>B::fun</code>.  And so, the program will print <code>float B</code>.</p>
<p>Can it be fixed?  Well, it depends on what you mean by &#8220;fixed&#8221;, as nothing is broken.  But it surely is possible to bring back <code>A</code>&#8216;s <code>fun</code> into <code>B</code>&#8216;s interface so that it is considered as a potential overload again.  One labourious way to do it is by declaring a new function in <code>B</code> that forwards the call to <code>A</code>:  </p>
<pre>// laborious solution
struct B: A
{
	void fun(int x) { A::fun(x); }
	void fun(float x) { std::cout &lt;&lt; "float B\n"; }
};</pre>
<p>However, if there are many <code>fun</code> overloads in <code>A</code>, and many different derived classes like <code>B</code>, this quickly gets very annoying &#8230;</p>
<p>A far more easier solution is the <em>using-declaration</em> (C++ 98, 7.3.3 and 10.2 &sect; 2): <em>&#8220;A using-declaration introduces a name into the declarative region in which the using-declaration appears.  That name is a synonym for the name of some entity declared elsewhere.&#8221;</em>  It will declare <code>A</code>&#8216;s <code>fun</code> into <code>B</code>&#8216;s scope, and make it as such available as a potential overload:</p>
<pre>// easier solution
struct B: A
{
	using A::fun;
	void fun(float x) { std::cout &lt;&lt; "float B\n"; }
};</pre>
<p>Now the compiler will also consider <code>A::fun</code> as a possible overload and print <code>int A</code>.</p>
<p>There are however a few cases in which the using-declaration won&#8217;t help: e.g. you can&#8217;t use it on constructors as they don&#8217;t have a <em>name</em>.  For more details, see section 7.3.3 of the C++ 98 standard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2009/03/12/name-hiding-using-declaration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Write Shared Libraries</title>
		<link>http://www.bramz.net/2009/03/09/shared-libraries/</link>
		<comments>http://www.bramz.net/2009/03/09/shared-libraries/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 21:40:40 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.net/?p=303</guid>
		<description><![CDATA[This post serves as a bookmark for a little gem I&#8217;ve found: How To Write Shared Libraries (pdf) by Ulrich Drepper. It&#8217;s a 47 page document on writing shared libraries in a Unix environment.]]></description>
			<content:encoded><![CDATA[<p>This post serves as a bookmark for a little gem I&#8217;ve found: <a href="http://people.redhat.com/drepper/dsohowto.pdf">How To Write Shared Libraries</a> (pdf) by <a href="http://people.redhat.com/drepper/">Ulrich Drepper</a>.  It&#8217;s a 47 page document on writing shared libraries in a Unix environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2009/03/09/shared-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python string interpolation trick</title>
		<link>http://www.bramz.net/2008/12/07/python-string-interpolation-trick/</link>
		<comments>http://www.bramz.net/2008/12/07/python-string-interpolation-trick/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 16:55:15 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.net/?p=222</guid>
		<description><![CDATA[Today, I will show you a trick that may help you with the heavier string formatting jobs in Python. Most people using Python know how to format output using string interpolation. It works much like C&#8217;s sprintf, except for the funny % operator: &#62;&#62;&#62; a = "the Knights" &#62;&#62;&#62; b = "Ni" &#62;&#62;&#62; "we are [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I will show you a trick that may help you with the heavier string formatting jobs in Python.</p>
<p>Most people using <a href="http://python.org/">Python</a> know how to format output using <a href="http://docs.python.org/library/stdtypes.html#string-formatting-operations">string interpolation</a>. It works much like C&#8217;s <code>sprintf</code>, except for the funny <code>%</code> operator:</p>
<pre>
&gt;&gt;&gt; a = "the Knights"
&gt;&gt;&gt; b = "Ni"
&gt;&gt;&gt; "we are %s who say %s" % (a, b)
'we are the Knights who say Ni'
</pre>
<p>What is less known is that you can replace the right hand argument by a dictionary and use its keys to tell what value goes where.  That&#8217;s handy when you need to insert more than one or two in a string, or when a single value is used more than once.  Especially for localisation strings, it gives you the flexibility to determine the when and where of the values in the string itself. </p>
<pre>
&gt;&gt;&gt; "we are %<strong>(who)</strong>s who say %<strong>(what)</strong>s" % <strong>{"who": a, "what": b}</strong>
'we are the Knights who say Ni'
</pre>
<p>Combine that with the even lesser known function <a href="http://docs.python.org/library/functions.html#vars"><code>vars()</code></a> which returns a dictionary of the local variables and their values:</p>
<pre>
&gt;&gt;&gt; vars()
{'__builtins__': &lt;module '__builtin__' (built-in)&gt;, '__name__':
 '__main__', 'b': 'Ni', '__doc__': None, 'a': 'the Knights'}
</pre>
<p>Use it at the right hand, and you can simply use the variable names as keywords:</p>
<pre>
&gt;&gt;&gt; "we are %<strong>(a)</strong>s who say %<strong>(b)</strong>s" % <strong>vars()</strong>
'we are the Knights who say Ni'
</pre>
<p>This probably is the closest you can get to the Perl and PHP style syntax <code>"we are the $a who say $b"</code>.</p>
<p>Share and Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2008/12/07/python-string-interpolation-trick/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>manuals on software optimization</title>
		<link>http://www.bramz.net/2008/12/05/manuals-software-optimization/</link>
		<comments>http://www.bramz.net/2008/12/05/manuals-software-optimization/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 22:13:47 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.net/?p=119</guid>
		<description><![CDATA[While looking for some info on 64 bit masm, I stumbled on Agner Fog&#8217;s site with five comprehensive manuals on software optimization. Each covers a different topic: optimizations in C/C++ and assembly, microarchitectures, instruction tables and calling conventions.]]></description>
			<content:encoded><![CDATA[<p>While looking for some info on <a href="http://msdn.microsoft.com/en-us/library/hb5z4sxd.aspx">64 bit masm</a>, I stumbled on Agner Fog&#8217;s site with <a href="http://www.agner.org/optimize/">five comprehensive manuals</a> on software optimization.  Each covers a different topic: optimizations in C/C++ and assembly, microarchitectures, instruction tables and calling conventions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2008/12/05/manuals-software-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pyvtuneapi 0.1: VTune API for Python</title>
		<link>http://www.bramz.net/2007/07/11/vtuneapi-01-vtune-api-for-python/</link>
		<comments>http://www.bramz.net/2007/07/11/vtuneapi-01-vtune-api-for-python/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 22:27:07 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.org/2007/07/11/vtuneapi-01-vtune-api-for-python/</guid>
		<description><![CDATA[pyvtuneapi is a very simple extension that binds the VTune API to Python. If you have VTune, and you&#8217;re using it to profile a Python driven application, you can use pyvtuneapi to pause and resume the analyzer.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bramz.net/projects-code/pyvtuneapi/">pyvtuneapi</a> is a very simple extension that binds the <a href="http://www.intel.com/software/products/documentation/vlin/mergedprojects/analyzer_ec/analyzer_hh/using_apis.htm">VTune API</a> to <a href="http://python.org">Python</a>.  If you have <a href="http://www.intel.com/cd/software/products/asmo-na/eng/vtune/239144.htm">VTune</a>, and you&#8217;re using it to profile a Python driven application, you can use <code>pyvtuneapi</code> to pause and resume the analyzer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2007/07/11/vtuneapi-01-vtune-api-for-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>does KB936357 patch kill VS2005? (probably KB928365 instead)</title>
		<link>http://www.bramz.net/2007/07/11/does-kb936357-patch-kill-vs2005/</link>
		<comments>http://www.bramz.net/2007/07/11/does-kb936357-patch-kill-vs2005/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 18:44:20 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.org/2007/07/11/does-kb936357-patch-kill-vs2005/</guid>
		<description><![CDATA[As you could read in my previous post, my devenv.exe stopped working since last Patch Tuesday updates. Since rebooting and even reinstalling the entire VS2005 suite didn&#8217;t resolve the problem, I&#8217;ve tried the only other approach I could think of apart from reformating my laptop: reverting the windows updates. I made an extra backup of [...]]]></description>
			<content:encoded><![CDATA[<p>As you could read in my previous post, my <a href="http://www.bramz.net/2007/07/11/today-vs2005-died-badly/">devenv.exe stopped working</a> since last Patch Tuesday updates.  Since rebooting and even reinstalling the entire VS2005 suite didn&#8217;t resolve the problem, I&#8217;ve tried the only other approach I could think of apart from reformating my laptop: reverting the windows updates.  I made an extra backup of my data, and the first update I tried to uninstall was <a href="http://support.microsoft.com/kb/936357">KB936357</a>, a microcode patch for the Intel Core 2 Duo (which my system runs on).  Surprisingly, devenv.exe came back alive!</p>
<p>What&#8217;s going on here?  Does devenv.exe rely on a quirk of the Core 2 Duo that is now patched by that update?  Or is it all just coincidence?  Yet, the patch seems to be a <a href="http://www.theinquirer.net/default.aspx?article=40567">critical</a> <a href="http://hardware.slashdot.org/article.pl?sid=07/06/26/2152246">update</a>.</p>
<p>Hopefully to be continued &#8230;</p>
<p><strong>update 11th July 2007:</strong> I tried to reinstall the patch, and this time, things are still working (knocking on wood).  So, perhaps it was just a one-time quirk of the gods?</p>
<p><strong>update 12th July 2007</strong>: It seems that <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1851226&#038;SiteID=1">other people have experienced the same problems</a> as well.  Though they&#8217;re reporting the KB928365 update as the culprit, which is a security update for the .NET Framework v2.0.  Same symptoms, uninstalling/reinstalling the patch did the trick.  It&#8217;s quite weird that uninstalling a different patch resolved the problem (I have the KB928365 patch installed as well), and that reinstalling that patch didn&#8217;t result in the same problem again.  So, maybe the real culprit is still something else?</p>
<p><a href="http://www.theregister.co.uk/2007/07/12/ms_patch_problems/">The Registry</a> is also reporting on problems due to .NET updates of last Patch Tuesday, though their reference is to patch <a href="http://www.microsoft.com/technet/security/Bulletin/MS07-040.mspx">MS07-040</a> of <a href="http://support.microsoft.com/default.aspx/kb/931212/en-us">KB931212</a> which actually includes KB928365 and KB928366</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2007/07/11/does-kb936357-patch-kill-vs2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>today, vs2005 died, badly!</title>
		<link>http://www.bramz.net/2007/07/11/today-vs2005-died-badly/</link>
		<comments>http://www.bramz.net/2007/07/11/today-vs2005-died-badly/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 16:18:32 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.org/2007/07/11/today-vs2005-died-badly/</guid>
		<description><![CDATA[Today, after a mandatory reboot because of a patch Tuesday windows update, devenv.exe of Visual Studio 2005 no longer wants to start. Well, it tries to start, and sometimes it gives a flash of its main window, but then it dies without a cry. The first thing one tries to resolve the problem is to [...]]]></description>
			<content:encoded><![CDATA[<p>Today, after a mandatory reboot because of a patch Tuesday windows update, devenv.exe of Visual Studio 2005 no longer wants to start.  Well, it tries to start, and sometimes it gives a flash of its main window, but then it dies without a cry.</p>
<p>The first thing one tries to resolve the problem is to reboot &#8230; to no avail.  Uh-oh &#8230;  Trying to start devenv.exe from another account?  It doesn&#8217;t start either.  Double Uh-oh &#8230;</p>
<p>OK, no panic yet.  If rebooting doesn&#8217;t help, reinstalling the product will.  It&#8217;s a bit tedious, but it has to be done.  Removing the current installation, installing VS2005 from scratch.  Freeing 3 gigs on C: to reinstall SP1, installing SP1, fingers crossed &#8230; still doesn&#8217;t reboot!  Now I&#8217;m really scared!</p>
<p>WTF may be causing that much of trouble to devenv.exe?  The only thing left to do is to try to reverse the windows updates &#8230;</P></p>
<p>To be continued &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2007/07/11/today-vs2005-died-badly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross-platform minidump with Google-Breakpad</title>
		<link>http://www.bramz.net/2007/06/17/cross-platform-minidump-with-google-breakpad/</link>
		<comments>http://www.bramz.net/2007/06/17/cross-platform-minidump-with-google-breakpad/#comments</comments>
		<pubDate>Sun, 17 Jun 2007 16:15:48 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.org/2007/06/17/cross-platform-minidump-with-google-breakpad/</guid>
		<description><![CDATA[From my previous post, you might know about my recent interest in minidumps to debug remote applications. Since then, I&#8217;ve been trying to implement an automatic and unattended crash dump facilitiy in Lass. On the Win32 platform, the key functions are SetUnhandledExceptionFilter in kernel32.lib and MiniDumpWriteDump in dbghelp.lib. The former lets you set a function [...]]]></description>
			<content:encoded><![CDATA[<p>From my previous post, you might know about my recent interest in minidumps to debug remote applications.  Since then, I&#8217;ve been trying to implement an automatic and unattended crash dump facilitiy in Lass.  On the Win32 platform, the key functions are <a href="http://msdn2.microsoft.com/en-us/library/ms680634.aspx">SetUnhandledExceptionFilter</a> in kernel32.lib and <a href="http://msdn2.microsoft.com/en-us/library/ms680360.aspx">MiniDumpWriteDump</a> in dbghelp.lib.  The former lets you set a function to handle any exceptions that boil up from the application unhandled.  The latter is used in that function to actually produce the minidump.</p>
<p>An interesting article on the subject is <a href="http://www.debuginfo.com/articles/debugfilters.html">debugging custom filters for unhandled exceptions</a>, especially the part about <a href="http://www.debuginfo.com/articles/debugfilters.html#enforce">patching the SetUnhandledExceptionFilter</a> function once you&#8217;ve set your filter, to prevent other modules (and even the runtime library) to set their own exception filters and thereby disabling yours.  They do that by dynamically replacing the first instructions of that function by:</p>
<pre>
xor eax, eax
ret 0x4
</pre>
<p>Crude, but effective.</p>
<p>Once I&#8217;ve got it working on Win32, I started looking around for ways to deal with crashes in a similar way on the Linux platform.  This has lead me to the discovery of <a href="http://code.google.com/p/google-breakpad/">Google-Breakpad</a> (formely known as <a href="http://code.google.com/p/airbag/">Airbag</a>).  It is a small open-source library that does exactly what I need: cross platform generation of minidumps on windows, mac and linux.  It includes client and server parts, the client existing of a <a href="http://code.google.com/p/google-breakpad/wiki/ClientDesign">handler and sender</a>.  The handler is the actual exception handler that generates the minidump, the sender can be attached to the handler as a callback, in order to submit the minidump to a (public) server.  Breakpad does not include an complete functional server, but it includes an <a href="http://code.google.com/p/google-breakpad/wiki/ProcessorDesign">minidump processor</a> that converts the minidumps in human-readable stack walk, using local (local to the server) available symbol information.  The benefit of doing this conversion on a server, in contrast to GNOME’s Bug-Buddy and Apple’s CrashReporter, is that the symbol files do not have to be shipped to the customer.</p>
<p>Breakpad surely looks like a promising tool that could be used in many (open-source) projects.  Currently, there&#8217;s a mutual effort to include Breakpad in the next Firefox, replacing the closed source Talkback.  This will certainly be a good test case, tremendously improving the library with experiences from a large scale project.  For me, I certainly will try to include Breakpad in our software as well.  There&#8217;s one part missing though: how to set up a public server that can receive the minidumps, automatically process them and inform me of the result.  A few hints about deploying such a server may be found on the <a href="http://wiki.mozilla.org/Breakpad:Current_Implementation">Mozilla wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2007/06/17/cross-platform-minidump-with-google-breakpad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>fun with crash dumps and remote debugging</title>
		<link>http://www.bramz.net/2007/06/09/fun-with-crash-dumps-and-remote-debugging/</link>
		<comments>http://www.bramz.net/2007/06/09/fun-with-crash-dumps-and-remote-debugging/#comments</comments>
		<pubDate>Sat, 09 Jun 2007 18:31:53 +0000</pubDate>
		<dc:creator>Bramz</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.bramz.org/2007/06/09/fun-with-crash-dumps-and-remote-debugging/</guid>
		<description><![CDATA[Yesterday, I had some fun playing around with remote debugging and examining crash dumps. In the lab, we&#8217;re currently running a lot of noise map simulations for a project we&#8217;re involved in. These simulations are distributed over all available computers in the lab, a mixture of old and new, often actively used by other people [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I had some fun playing around with remote debugging and examining crash dumps.  In the <a href="http://acoustweb.intec.ugent.be/">lab</a>, we&#8217;re currently running a lot of <a href="http://acoustweb.intec.ugent.be/content/view/29/52/">noise map</a> simulations for a project we&#8217;re involved in.  These simulations are distributed over all available computers in the lab, a mixture of old and new, often actively used by other people as desktop. The fun part starts when things do not run as smoothly as planned, which is unfortunately often the case.  What else to expect expected from software that is simultaneously developed and used in production.  We&#8217;re a research lab, after all.</p>
<p>Our current noise mapper is pretty young and only supports full multi-threading since recently. Since we use this to squeeze out that extra bit of performance on machines that have more than one core, we started noticing &#8211; not surprisingly &#8211; inconsistent and hard-to-reproduce crashes. Reproducing the crashes on the development box was not feasible as you could just spend hours waiting for the crash to happen.  Debugging the crashed programs locally wasn&#8217;t an option either, as most of them didn&#8217;t have any debugging tools installed whatsoever. </p>
<p>Last week, I&#8217;ve found some time to investigate the problem further, and I first started poking around with remote debugging in Visual Studio 2005, but it wasn&#8217;t really helpful. Normal use requires that you have identical accounts on both PCs.  In the heterogeneous environment of our lab, without central user management and where everyone admins his own desktop PC, this is not a easy thing.  However, it also has a no-authorization mode (who needs security anyway =), and after disabling the firewall (the rule automatically created by the remote debugger somehow wasn&#8217;t enough) and modifying some obscure security setting, I finally was able to connect to it from my dev box.  Unfortunately, I only got corrupted call stacks, so it wasn&#8217;t of any help at all.</p>
<p>But that&#8217;s when I noticed something really wonderful: <a href="http://blogs.msdn.com/greggm/archive/2007/05/24/debugging-windows-error-reporting.aspx">minidumps</a>.  When your program crashes the hard way on WinXP and later, it pops up a dialog box asking if you want to send debug information to Microsoft.  You of course don&#8217;t want to do that, but at that moment, a minidump already has been created.  You just need to secure it before you click away the dialog box.  Then you copy it to your dev box, open it in visual studio and press F5.  Et voila, you get an instant reproduction of the crash, ready to be debugged.  Then it was almost a breeze to solve the problem.</p>
<p>Why have I never noticed this before?  It&#8217;s so helpful to investigate problems that happen on machines other than yours.  It&#8217;s plain magic.  I&#8217;m thinking of building it in in our software so that the crash dumps are automatically send to me.  If I also can avoid the dialog box, I can run the simulations unattended, and still be reported of any issue.  When a crash happens, the program simply sends me the crash dump and tries to run the next job.  I already have something similar for problems that arise in the Python code of the simulations, but this would make it complete.</p>
<p>Perhaps to be continued =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bramz.net/2007/06/09/fun-with-crash-dumps-and-remote-debugging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
