diff options
author | Zoltan Varga <vargaz@gmail.com> | 2004-09-06 19:58:16 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2004-09-06 19:58:16 +0400 |
commit | 37554304830f7e71d13d79f608473b5b0b6af931 (patch) | |
tree | f0f59728321e6e98a933322b000937b496819df7 | |
parent | 7e891a4721ec85e223b9c5cc01bc5f2a3ec1733f (diff) |
2004-09-06 Zoltan Varga <vargaz@freemail.hu>
* exceptions-x86.c (mono_arch_find_jit_info): Pop arguments off the
stack. Fixes #64674.
* exceptions.cs: Add test for unwinding of call arguments.
svn path=/trunk/mono/; revision=33418
-rw-r--r-- | mono/mini/ChangeLog | 6 | ||||
-rw-r--r-- | mono/mini/exceptions-x86.c | 8 | ||||
-rw-r--r-- | mono/mini/exceptions.cs | 25 |
3 files changed, 39 insertions, 0 deletions
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 22f3c5e9f99..85a3e553bb4 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,9 @@ +2004-09-06 Zoltan Varga <vargaz@freemail.hu> + + * exceptions-x86.c (mono_arch_find_jit_info): Pop arguments off the + stack. Fixes #64674. + + * exceptions.cs: Add test for unwinding of call arguments. Mon Sep 6 05:50:02 PDT 2004 Paolo Molaro <lupus@ximian.com> diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index 3c8ba8fdf05..95df078100c 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -418,6 +418,14 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf new_ctx->SC_EIP = *((int *)ctx->SC_EBP + 1) - 1; new_ctx->SC_EBP = *((int *)ctx->SC_EBP); + /* Pop arguments off the stack */ + { + MonoJitArgumentInfo *arg_info = alloca (sizeof (MonoJitArgumentInfo) * (ji->method->signature->param_count + 1)); + + guint32 stack_to_pop = mono_arch_get_argument_info (ji->method->signature, ji->method->signature->param_count, arg_info); + new_ctx->SC_ESP += stack_to_pop; + } + *res = *ji; return res; #ifdef MONO_USE_EXC_TABLES diff --git a/mono/mini/exceptions.cs b/mono/mini/exceptions.cs index eea343dbb77..4dfd149ec3f 100644 --- a/mono/mini/exceptions.cs +++ b/mono/mini/exceptions.cs @@ -2139,5 +2139,30 @@ class Tests { return 0; } + + struct S { + int i, j, k, l, m, n; + } + + static IntPtr[] addr; + + static unsafe void throw_func (int i, S s) { + addr [i] = new IntPtr (&i); + throw new Exception (); + } + + /* Test that arguments are correctly popped off the stack during unwinding */ + static int test_0_stack_unwind () { + addr = new IntPtr [1000]; + S s = new S (); + for (int j = 0; j < 1000; j++) { + try { + throw_func (j, s); + } + catch (Exception) { + } + } + return (addr [0].ToInt64 () - addr [100].ToInt64 () < 100) ? 0 : 1; + } } |