[Mono-list] RFC: Corlib Unit Test on Linux How-To

Linus Upson linus@linus.com
Mon, 29 Apr 2002 19:57:34 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_002E_01C1EFB8.1B127560
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I found the problem. When unwinding the stack in exceptions.c a test was
using EIP when it should have used EBP. There was a similar typo in the
exceptions docs file. A patch for both is attached. It is just dumb luck
that on Linux the top of the stack is at a larger address than the code.

Other things I found along the way and am looking in to:

- MethodInfo.GetMethod(System.String) doesn't work on mono. The overload
which takes an array of parameter Types does, however.

- .Net's implementation of MethodInfo.Invoke() catches all Exceptions
(need to check if it also catches non-CLS exceptions) and wraps them in
a TargetInvocationException before throwing that to the caller. Mono
lets the original exception pass through.

- I have a vague recollection of reading somewhere that .Net doesn't run
finally clauses until it finds a matching catch block for the exception.
Mono calls the finally blocks as it unwinds the stack. I'm scratching my
head to figure out if it matters. I'm going to write some tests to see
if I can find any ways in which mono's behavior differs from .Net in
this area.

Now that the corlib unit tests are kind of working on windows, I'm
working on a test case for MethodInfo as I go. Please let me know if I
should enter these issues in bugzilla as well.

Linus


-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com] On
Behalf Of Nick Drochak
Sent: Monday, April 29, 2002 8:04 AM
To: 'Linus Upson'; mono-list@ximian.com
Subject: RE: [Mono-list] RFC: Corlib Unit Test on Linux How-To


| I tried testing corlib on Windows (using mono, not .net, very 
| similar to the setup you describe in the HOWTO) and am 
| running in to a problem. It appears that the Windows 

With the recent changes to cvs, I am getting this:
$ ./mono NUnitConsole.exe MonoTests.AllTests,corlib_test.dll
 .
(process:3972): ** WARNING **: unhandled exception
System.ArgumentNullException:
 "Argument cannot be null"
in System.Array:Sort ()
in MonoTests.System.ArrayTest:TestSort ()
in (unmanaged) System.Reflection.MonoMethod:InternalInvoke ()

Seems like mono stopping on the first exception thrown, like --dieonex
does for mint.

| I'm new to mono so I'm not set up to debug the runtime yet. 
| Is it possible to build/debug the mono runtime with the MSFT 
| tools or should I install gdb to track this down?

I haven't tried debugging on windows yet, except with a little bit of
gdb.  I had some problems which I don't remember any more and gave up.
However, maybe it's time to try again.

Nick D.



_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

------=_NextPart_000_002E_01C1EFB8.1B127560
Content-Type: application/octet-stream;
	name="exceptions.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="exceptions.patch"

Index: mono/jit/exception.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/mono/jit/exception.c,v=0A=
retrieving revision 1.5=0A=
diff -u -r1.5 exception.c=0A=
--- mono/jit/exception.c	29 Apr 2002 10:19:16 -0000	1.5=0A=
+++ mono/jit/exception.c	30 Apr 2002 02:26:12 -0000=0A=
@@ -278,7 +278,7 @@=0A=
 			g_free (tmp);=0A=
 		}=0A=
 =0A=
-		if (ctx->SC_EIP < (unsigned)mono_end_of_stack)=0A=
+		if (ctx->SC_EBP < (unsigned)mono_end_of_stack)=0A=
 			arch_handle_exception (ctx, obj);=0A=
 		else {=0A=
 			g_assert (cleanup);=0A=
Index: docs/exceptions=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mono/docs/exceptions,v=0A=
retrieving revision 1.2=0A=
diff -u -r1.2 exceptions=0A=
--- docs/exceptions	15 Mar 2002 08:23:34 -0000	1.2=0A=
+++ docs/exceptions	30 Apr 2002 02:26:12 -0000=0A=
@@ -16,7 +16,7 @@=0A=
 =0A=
 void handle_exception ((struct sigcontext *ctx, gpointer obj)=0A=
 {=0A=
-        if (ctx->ip < mono_end_of_stack) {=0A=
+        if (ctx->bp < mono_end_of_stack) {=0A=
 	        /* unhandled exception */=0A=
 	        abort ();=0A=
 	}=0A=

------=_NextPart_000_002E_01C1EFB8.1B127560--