[Mono-dev] Crash on Android when trying to execute dynamic code

Robert Pickering robert at strangelights.com
Sat Jun 15 12:37:32 UTC 2013


I've been trying to port the F# Interactive to run directly on android.

I have a package that loads under android and can generate IL but it fails
with an assertion (presumable in the JIT compiler, but I'm not 100% sure).

The app source can be found here:
https://github.com/robertpi/fsiandroid

You need the latest Xamarian Studio updates from beta channel to build and
run it. You always need a new line the program you enter, or the compiler
refuses to run (not sure why). I've been testing with the following snippet:
"let x = ""
"

I seem to have enter the program twice before it compiles and executes, not
sure why, working on finding this out myself.

I tried grab the IL code generated, but for some reason it always gets
truncated in the log.

The program fails with the following stack trace:
06-15 12:22:33.666 F/        ( 5381): * Assertion: should not be reached at
/Users/builder/data/lanes/monodroid-mlion-master/f6831347/source/mono/mono/mini/mini-arm.c:3599
06-15 12:22:33.666 E/mono-rt ( 5381): Stacktrace:
06-15 12:22:33.666 E/mono-rt ( 5381):
06-15 12:22:33.666 E/mono-rt ( 5381):   at <unknown> <0xffffffff>
06-15 12:22:33.666 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.ProcessInputs
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/ParsedInput>,bool,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/Ident>)
[0x005d7] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1000
06-15 12:22:33.676 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompiler.EvalParsedDefinitions
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,bool,bool,Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Compiler.Ast/SynModuleDecl>)
[0x0006a] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1042
06-15 12:22:33.676 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/clo at 1714-498.Invoke(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState)
[0x0061c] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1721
06-15 12:22:33.676 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.InteractiveCatch<a>
(Microsoft.FSharp.Core.FSharpFunc`2<a, System.Tuple`2<a,
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionStepStatus>>,a)
[0x0000e] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1667
06-15 12:22:33.686 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteraction
(bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction)
[0x00000] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1714
06-15 12:22:33.686 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.ExecInteractions
(bool,Microsoft.FSharp.Compiler.Build/TcConfig,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction>)
[0x00231] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1830
06-15 12:22:33.686 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiInteractionProcessor.MainThreadProcessParsedInteraction
(bool,Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Compiler.Ast/ParsedFsiInteraction>,Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState)
[0x0004f] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1853
06-15 12:22:33.686 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/res at 1915-17.Invoke(Microsoft.FSharp.Compiler.Interactive.Shell/FsiDynamicCompilerState)
[0x00000] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:1915
06-15 12:22:33.696 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/runCodeOnMainThread at 2165-1.Invoke(Microsoft.FSharp.Core.Unit)
[0x00019] in
C:\code\fsharp\src\fsharp\fsi\fsi.fs:2168
06-15 12:22:33.706 E/mono-rt ( 5381):   at
<StartupCode$FSharp-Compiler-Mono-Android>.$Fsiaux/Microsoft-FSharp-Compiler-Interactive-IEventLoop-Invoke at 58-1.Invoke(Microsoft.FSharp.Core.Unit)
[0x00000] in
C:\code\fsharp\src\fsharp\fsiaux.fs:58
06-15 12:22:33.706 E/mono-rt ( 5381):   at
<StartupCode$FSharp-Compiler-Mono-Android>.$Fsiaux/run at 49-6.Invoke(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,
object>)
[0x0000d] in C:\code\fsharp\src\fsharp\fsiaux.fs:49
06-15 12:22:33.706 E/mono-rt ( 5381):   at
Microsoft.FSharp.Primitives.Basics.List.iter<T>
(Microsoft.FSharp.Core.FSharpFunc`2<T,
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T>)
<IL 0x0001b, 0x000e7>
06-15 12:22:33.706 E/mono-rt ( 5381):   at
Microsoft.FSharp.Collections.ListModule.Iterate<T>
(Microsoft.FSharp.Core.FSharpFunc`2<T,
Microsoft.FSharp.Core.Unit>,Microsoft.FSharp.Collections.FSharpList`1<T>)
<IL 0x00003, 0x0007f>
06-15 12:22:33.706 E/mono-rt ( 5381):   at
<StartupCode$FSharp-Compiler-Mono-Android>.$Fsiaux/run at 47-2.Invoke(Microsoft.FSharp.Core.Unit)
[0x00043] in
C:\code\fsharp\src\fsharp\fsiaux.fs:49
06-15 12:22:33.706 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.SimpleEventLoop.Microsoft-FSharp-Compiler-Interactive-IEventLoop-Run
() [0x0000e] in C:\code\fsharp\src\fsharp\fsiaux.fs:46
06-15 12:22:33.706 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/runLoop at 2221.Invoke(Microsoft.FSharp.Core.Unit)
[0x00061] in
C:\code\fsharp\src\fsharp\fsi\fsi.fs:2226
06-15 12:22:33.716 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell.DriveFsiEventLoop
(Microsoft.FSharp.Compiler.Interactive.Shell/FsiConsoleOutput) [0x00000] in
C:\code\fsharp\src\fsharp\fsi\fsi.fs:2220
06-15 12:22:33.716 E/mono-rt ( 5381):   at
Microsoft.FSharp.Compiler.Interactive.Shell/FsiEvaluationSession.Run ()
[0x00088] in C:\code\fsharp\src\fsharp\fsi\fsi.fs:2473
06-15 12:22:33.726 E/mono-rt ( 5381):   at
<StartupCode$FSInteractiveAndroid>.$MainActivity/OnCreate at 49.Invoke(Microsoft.FSharp.Core.Unit)
[0x00000] in
C:\code\FSIAndroid\FSInteractiveAndroid\MainActivity.fs:49
06-15 12:22:33.726 E/mono-rt ( 5381):   at
Microsoft.FSharp.Control.AsyncBuilderImpl/callA at 780.Invoke(Microsoft.FSharp.Control.AsyncParams`1<b>)
<IL 0x00053, 0x0022b>
06-15 12:22:33.726 E/mono-rt ( 5381):   at
Microsoft.FSharp.Control.AsyncBuilderImpl/queueAsync at 702.Invoke(Microsoft.FSharp.Core.Unit)
<IL 0x00036, 0x00113>
06-15 12:22:33.736 E/mono-rt ( 5381):   at
<StartupCode$FSharp-Core>.$Control.loop at 429-40(Microsoft.FSharp.Control.Trampoline,Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,
Microsoft.FSharp.Control.FakeUnitValue>) <IL 0x00003, 0x00073>
06-15 12:22:33.746 E/mono-rt ( 5381):   at
Microsoft.FSharp.Control.Trampoline.ExecuteAction
(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,
Microsoft.FSharp.Control.FakeUnitValue>) <IL 0x0001a, 0x00177>
06-15 12:22:33.746 E/mono-rt ( 5381):   at
Microsoft.FSharp.Control.TrampolineHolder.Protect
(Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,
Microsoft.FSharp.Control.FakeUnitValue>) <IL 0x00039, 0x0018b>
06-15 12:22:33.746 E/mono-rt ( 5381):   at
<StartupCode$FSharp-Core>.$Control/-ctor at 486-1.Invoke (object) <IL 0x00019,
0x000d7>
06-15 12:22:33.746 E/mono-rt ( 5381):   at (wrapper runtime-invoke)
<Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr)
<IL 0x00052, 0xffffffff>
06-15 12:22:33.746 E/mono-rt ( 5381):
06-15 12:22:33.746 E/mono-rt ( 5381):
=================================================================
06-15 12:22:33.746 E/mono-rt ( 5381): Got a SIGSEGV while executing native
code. This usually indicates
06-15 12:22:33.746 E/mono-rt ( 5381): a fatal error in the mono runtime or
one of the native libraries
06-15 12:22:33.746 E/mono-rt ( 5381): used by your application.
06-15 12:22:33.746 E/mono-rt ( 5381):
=================================================================
06-15 12:22:33.746 E/mono-rt ( 5381):
06-15 12:22:33.886 D/Zygote  (   36): Process 5381 exited cleanly (255)


I've tried checking out mini-arm.c:3599, but it currently seems to be a
comment. I'm not sure how you find the source for the version of Mono that
Android is running on. Any help fixing this greatly appreciated.

Many thanks,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130615/4e1a070c/attachment.html>


More information about the Mono-devel-list mailing list