<?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>centriment &#187; fix</title>
	<atom:link href="http://www.centriment.com/tag/fix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.centriment.com</link>
	<description>stories of the spirit living inside the computer</description>
	<lastBuildDate>Sun, 26 Jul 2009 12:29:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Monodevelop 2.0 debugger with Mono 2.4.2.2</title>
		<link>http://www.centriment.com/2009/07/26/monodevelop-2-0-debugger-with-mono-2-4-2-2/</link>
		<comments>http://www.centriment.com/2009/07/26/monodevelop-2-0-debugger-with-mono-2-4-2-2/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 12:17:32 +0000</pubDate>
		<dc:creator>Jan Dzik</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono/.NET]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[monodevelop]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.centriment.com/?p=260</guid>
		<description><![CDATA[A while ago I posted a how-to on compiling Mono 2.4 from source on Ubuntu. Well, the mono project released an update: mono 2.4.2.2 about a month ago. So, obviously people wanted to update their systems and tried to compile the new source packages. But there seems to be a problem. The debugger plugin for [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I posted a how-to on compiling Mono 2.4 from source on Ubuntu. Well, the mono project released an update: mono 2.4.2.2 about a month ago. So, obviously people wanted to update their systems and tried to compile the new source packages. But there seems to be a problem. The debugger plugin for monodevelop 2.0 (monodevelop-debugger-mdb-2.0) failed to compile.</p>
<p>Responding to a series of comments on my blog mentioning this annoying problem I looked into the situation and I have produced a patch for monodevelop-debugger-mbd-2.0 sources. You can download the patch from <a title="Patch file for monodevelop-debugger-mdb-2.0" href="http://www.centriment.com/downloads/patches/monodevelop-debugger-mdb-2.0.mono-debugger-2.4.2.1.patch">here</a>, and the instructions on applying it in this <a title="How to apply the monodevelop-debugger-mdb-2.0 patch" href="http://www.centriment.com/2009/07/26/patch-for-monodevelop-2-0-debugger-for-mono-2-4-2-2">post</a>.</p>
<p>As it turns out, in mono 2.4.2.2 there is a new version of the mono debugger, version 2.4.2.1. And with this new version came some breaking changes. Monodevelop uses the mono debugger through a plugin (contained in this source package: <a href="http://ftp.novell.com/pub/mono/sources/monodevelop-debugger-mdb/monodevelop-debugger-mdb-2.0.tar.bz2">monodevelop-debugger-mdb-2.0.tar.bz2</a>). The sources of the plugin were not updated for the new version of mono debugger so any attempt to compile them failed.</p>
<p>Following is an excerpt from the compilation indicating the problem:</p>
<pre>./RuntimeInvokeManager.cs(49,50): warning CS0612: `Mono.Debugger.Thread.RuntimeInvoke(Mono.Debugger.Languages.TargetFunctionType, Mono.Debugger.Languages.TargetStructObject, Mono.Debugger.Languages.TargetObject[], bool, bool)' is obsolete
./RuntimeInvokeManager.cs(57,68): error CS1501: No overload for method `AbortInvocation' takes `0' arguments
./RuntimeInvokeManager.cs(78,60): error CS1501: No overload for method `AbortInvocation' takes `0' arguments
Compilation failed: 2 error(s), 2 warnings
make[1]: *** [../build/DebuggerServer.exe] Error 1
make[1]: Leaving directory `/home/anirothan/src/mono-2.4.2.2/monodevelop-debugger-mdb-2.0/Mono.Debugging.Server.Mdb'
make: *** [all-recursive] Error 1</pre>
<p>The problem is with the <em>monodevelop-debugger-mdb-2.0/Mono.Debugging.Server.Mdb/RuntimeInvokeManager.cs</em> file. On line 49 the RuntimeInvoke() mehtod is deprecated in the new version of mono debugger as indicated by the warning message, and the two invocations to AbortInvocation() on lines 57 and 78 have incompatible signatures with the method&#8217;s definition.</p>
<p>Invocation of AbortInvocation in <em>monodevelop-debugger-mdb-2.0/Mono.Debugging.Server.Mdb/RuntimeInvokeManager.cs </em>lines 55-58 and 76-79:</p>
<pre>res.Abort ();
res.CompletedEvent.WaitOne ();
ctx.Thread.AbortInvocation ();
WaitToStop (ctx.Thread);</pre>
<p>The AbortInovacation() method is defined in the mono debugger package, in <em>mono-debugger-2.4.2.1/classes/Thread.cs</em>.  If you compare this method between mono-debugger-2.4 and mono-debugger-2.4.2.1 you will see that in 2.4 it is public whereas in 2.4.2.1 it is made internal. Therefore, we couldn&#8217;t just figure out what the parameter to AbortInvocation() should be since there would be now way of invoking it.</p>
<p>AbortInvocation() in mono-debugger-2.4</p>
<pre>public void AbortInvocation ()
{
  CommandResult result;

  lock (this) {
    check_alive ();
    result = servant.AbortInvocation ();
  }

  result.Wait ();
}</pre>
<p>AbortInvocation() in mono-debugger-2.4.2.1</p>
<pre>internal void AbortInvocation (long rti_id)
{
  lock (this) {
    check_alive ();
    servant.AbortInvocation (rti_id);
  }
}</pre>
<p>However, all is not lost. It seems that in <em>RuntimeInvokeManager.cs </em>there is an obvious code duplication in lines 55-58 and 76-79 where AbortInvocation() is called. It seems that these lines have been moved from the monodevelop debugger plugin to the mono debugger itself. Indeed, below is how Abort() is defined in the <em>RuntimeInvokeResult</em> class in <em>mono-debugger-2.4.2.1/classes/Thread.cs </em>and <em>mono-debugger-2.4/classes/Thread.cs:</em></p>
<p>in 2.4:</p>
<pre>public override void Abort ()
{
  thread.Stop ();
}</pre>
<p>and in 2.4.2.1</p>
<pre>public override void Abort ()
{
  Thread.AbortInvocation (ID);
  completed_event.WaitOne ();
}</pre>
<p>There it goes! The offending call to AbortInvocation(), which caused the compilation to fail, has been moved to Abort(), which is already being called on lines 55 and 76.</p>
<p>So, all we need to do is delete lines 56, 57 and 77,78 from <em>RuntimeInvokeManager.cs.</em> If we try to compile monodevelop-debugger-mdb-2.0 after this simple change we will see no more error messages and the debugger will work in monodevelop 2.0.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 81px; width: 1px; height: 1px;">
<pre>RuntimeInvokeManager.cs</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.centriment.com/2009/07/26/monodevelop-2-0-debugger-with-mono-2-4-2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
