blakeohare / crayon

Crayon Programming Language
MIT License
111 stars 10 forks source link

documentation tips on using mono alias with bash #270

Open TimJSwan89 opened 5 years ago

TimJSwan89 commented 5 years ago

I am getting a native crash error with a recent version of crayon:

$ type crayon
crayon is aliased to `mono $CRAYON_HOME/crayon.exe'

My Testing.build file:

{
    "id": "Testfail",
    "title": "Testfail",
    "output": "output/%TARGET_NAME%",
    "icons": ["assets/icon.png"],

    "targets": [
        {
            "name": "cbx",
            "source": "source"
        }
    ]
}

My hi.cry file:

import Game;
import Graphics2D;
function main() {
  print("Begin Program!");
  window = new GameWindow("Fail Test", 1, 1000, 900);
  window.pumpEvents();
}

That's apparently all it takes to crash something natively on my system, now.

$ crayon Testing.build 
Begin Program!

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
     (No frames) 

=================================================================
    Telemetry Dumper:
=================================================================
Pkilling 0x700001ccd000 from 0x7fffb5d2a380
Pkilling 0x700001ed0000 from 0x7fffb5d2a380
Pkilling 0x7000019c4000 from 0x7fffb5d2a380
Entering thread summarizer pause from 0x7fffb5d2a380
Finished thread summarizer pause from 0x7fffb5d2a380.

Waiting for dumping threads to resume

=================================================================
    External Debugger Dump:
=================================================================
(lldb) command source -s 0 '/tmp/mono-gdb-commands.36950'
Executing commands in '/tmp/mono-gdb-commands.36950'.
(lldb) process attach --pid 36950
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 36950 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff7d75922a libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff7d75922a <+10>: jae    0x7fff7d759234            ; <+20>
    0x7fff7d75922c <+12>: movq   %rax, %rdi
    0x7fff7d75922f <+15>: jmp    0x7fff7d74fb0e            ; cerror
    0x7fff7d759234 <+20>: retq   
Target 0: (mono-sgen64) stopped.

Executable module set to "/Library/Frameworks/Mono.framework/Versions/6.4.0/bin/mono-sgen64".
Architecture set to: x86_64-apple-macosx.
(lldb) thread list
Process 36950 stopped
* thread #1: tid = 0x513128, 0x00007fff7d75922a libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x51312e, 0x00007fff7d758a16 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x51312f, 0x00007fff7d74f246 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #4: tid = 0x513130, 0x00007fff7d75928a libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #5: tid = 0x513131, 0x00007fff7d75928a libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0x513133, 0x00007fff7d758a16 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_2407'
  thread #7: tid = 0x513135, 0x00007fff7d757ece libsystem_kernel.dylib`__accept + 10, name = 'tid_5203'
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff7d75922a libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x000000010fed5b3a mono-sgen64`mono_dump_native_crash_info at mini-posix.c:1110 [opt]
    frame #2: 0x000000010fed58bc mono-sgen64`mono_dump_native_crash_info(signal="SIGSEGV", mctx=<unavailable>, info=<unavailable>) at mini-posix.c:1158 [opt]
    frame #3: 0x000000010fe6e7b5 mono-sgen64`mono_handle_native_crash(signal="SIGSEGV", mctx=0x00000001128fd8b8, info=0x00000001128fdee0) at mini-exceptions.c:3328 [opt]
    frame #4: 0x000000010fdc7651 mono-sgen64`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x00000001128fdee0, context=0x00000001128fdf48, debug_fault_addr=0x0000000004272b1a) at mini-runtime.c:3363 [opt]
    frame #5: 0x00007fff7d916f5a libsystem_platform.dylib`_sigtramp + 26
    frame #6: 0x00007fff7753e785 SkyLight`SLDisplayBounds + 84
    frame #7: 0x0000000115cd61ad
    frame #8: 0x0000000115cc10b6
    frame #9: 0x000000010fdcac69 mono-sgen64`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x0000000000000000, exc=0x0000000000000010, error=<unavailable>) at mini-runtime.c:3184 [opt]
    frame #10: 0x000000010ffe8254 mono-sgen64`do_runtime_invoke(method=0x00007f90c48452c0, obj=0x0000000000000000, params=0x0000000000000000, exc=0x00007ffedfe46208, error=0x00007ffedfe46268) at object.c:3017 [opt]
    frame #11: 0x000000010ffe3f7d mono-sgen64`mono_runtime_class_init_full [inlined] mono_runtime_try_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=0x00007ffedfe46268) at object.c:3126 [opt]
    frame #12: 0x000000010ffe3f35 mono-sgen64`mono_runtime_class_init_full(vtable=0x00007f90c484c618, error=0x00007ffedfe46268) at object.c:546 [opt]
    frame #13: 0x000000010fe1a4b8 mono-sgen64`mono_generic_class_init(vtable=<unavailable>) at jit-icalls.c:1414 [opt]
    frame #14: 0x000000011036d979
    frame #15: 0x000000010fdcac69 mono-sgen64`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x0000000000000000, exc=0x00007f90c484c618, error=<unavailable>) at mini-runtime.c:3184 [opt]
    frame #16: 0x000000010ffe8254 mono-sgen64`do_runtime_invoke(method=0x00007f90c28a4aa8, obj=0x0000000000000000, params=0x0000000000000000, exc=0x00007ffedfe465f8, error=0x00007ffedfe46858) at object.c:3017 [opt]
    frame #17: 0x000000010ffe3f7d mono-sgen64`mono_runtime_class_init_full [inlined] mono_runtime_try_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=0x00007ffedfe46858) at object.c:3126 [opt]
    frame #18: 0x000000010ffe3f35 mono-sgen64`mono_runtime_class_init_full(vtable=0x00007f90c484be40, error=0x00007ffedfe46858) at object.c:546 [opt]
    frame #19: 0x000000010fdc293e mono-sgen64`mono_jit_compile_method_inner(method=0x00007f90c28a4640, target_domain=0x00007f90c1d13140, opt=<unavailable>, error=0x00007ffedfe46858) at mini.c:4165 [opt]
    frame #20: 0x000000010fdc63d9 mono-sgen64`mono_jit_compile_method_with_opt(method=0x00007f90c28a4640, opt=<unavailable>, jit_only=0, error=0x00007ffedfe46858) at mini-runtime.c:2445 [opt]
    frame #21: 0x000000010fe71602 mono-sgen64`common_call_trampoline(regs=0x00007ffedfe46928, code="H\x8b��8, m=0x00007f90c28a4640, vt=0x0000000000000000, vtable_slot=<unavailable>, error=0x00007ffedfe46858) at mini-trampolines.c:637 [opt]
    frame #22: 0x000000010fe71019 mono-sgen64`mono_magic_trampoline(regs=0x00007ffedfe46928, code="H\x8b��8, arg=0x00007f90c28a4640, tramp=<unavailable>) at mini-trampolines.c:777 [opt]
    frame #23: 0x000000011028c393
    frame #24: 0x0000000115cc0923
    frame #25: 0x0000000115cc0673
    frame #26: 0x0000000115cbf82b
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff7d758a16 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff7d921589 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x00000001100b58ee mono-sgen64`thread_func [inlined] mono_os_cond_wait(mutex=<unavailable>) at mono-os-mutex.h:177 [opt]
    frame #3: 0x00000001100b58db mono-sgen64`thread_func at sgen-thread-pool.c:165 [opt]
    frame #4: 0x00000001100b58cd mono-sgen64`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196 [opt]
    frame #5: 0x00007fff7d920661 libsystem_pthread.dylib`_pthread_body + 340
    frame #6: 0x00007fff7d92050d libsystem_pthread.dylib`_pthread_start + 377
    frame #7: 0x00007fff7d91fbf9 libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'Finalizer'
    frame #0: 0x00007fff7d74f246 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x000000011006320a mono-sgen64`finalizer_thread [inlined] mono_os_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) at mono-os-semaphore.h:84 [opt]
    frame #2: 0x00000001100631ff mono-sgen64`finalizer_thread at mono-coop-semaphore.h:41 [opt]
    frame #3: 0x00000001100631e5 mono-sgen64`finalizer_thread(unused=<unavailable>) at gc.c:967 [opt]
    frame #4: 0x000000011000f663 mono-sgen64`start_wrapper [inlined] start_wrapper_internal at threads.c:1221 [opt]
    frame #5: 0x000000011000f5d3 mono-sgen64`start_wrapper(data=0x00007f90c1d1fc80) at threads.c:1294 [opt]
    frame #6: 0x00007fff7d920661 libsystem_pthread.dylib`_pthread_body + 340
    frame #7: 0x00007fff7d92050d libsystem_pthread.dylib`_pthread_start + 377
    frame #8: 0x00007fff7d91fbf9 libsystem_pthread.dylib`thread_start + 13
  thread #4
    frame #0: 0x00007fff7d75928a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff7d92020e libsystem_pthread.dylib`_pthread_wqthread + 1552
    frame #2: 0x00007fff7d91fbe9 libsystem_pthread.dylib`start_wqthread + 13
  thread #5
    frame #0: 0x00007fff7d75928a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff7d920009 libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff7d91fbe9 libsystem_pthread.dylib`start_wqthread + 13
  thread #6, name = 'tid_2407'
    frame #0: 0x00007fff7d758a16 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff7d9215c2 libsystem_pthread.dylib`_pthread_cond_wait + 789
    frame #2: 0x00000001100c68b4 mono-sgen64`mono_os_cond_timedwait(cond=0x00000001101d70c0, mutex=0x00000001101d7080, timeout_ms=50) at mono-os-mutex.c:44 [opt]
    frame #3: 0x00000001100d256d mono-sgen64`mono_thread_info_sleep at mono-coop-mutex.h:100 [opt]
    frame #4: 0x00000001100d2541 mono-sgen64`mono_thread_info_sleep [inlined] sleep_interruptable(ms=<unavailable>, alerted=<unavailable>) at mono-threads.c:1623 [opt]
    frame #5: 0x00000001100d24f3 mono-sgen64`mono_thread_info_sleep(ms=50, alerted=<unavailable>) at mono-threads.c:1655 [opt]
    frame #6: 0x00000001100075a2 mono-sgen64`ves_icall_System_Threading_Thread_Sleep_internal(ms=50, error=<unavailable>) at threads.c:1755 [opt]
    frame #7: 0x000000010ff9e872 mono-sgen64`ves_icall_System_Threading_Thread_Sleep_internal_raw(a0=<unavailable>, error=0x0000700001ccc970) at icall-def.h:1056 [opt]
    frame #8: 0x000000011037be4d
    frame #9: 0x0000000111df9c73 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 67
    frame #10: 0x0000000111df9be8 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 104
    frame #11: 0x0000000111dfc6bc mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart_object + 108
    frame #12: 0x000000011036c824
    frame #13: 0x000000010fdcac69 mono-sgen64`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x0000700001cccea8, exc=0x0000000000000032, error=<unavailable>) at mini-runtime.c:3184 [opt]
    frame #14: 0x000000010ffe8254 mono-sgen64`do_runtime_invoke(method=0x00007f90c3021e18, obj=0x000000011040e6e8, params=0x0000700001cccea8, exc=0x0000000000000000, error=0x0000700001ccce40) at object.c:3017 [opt]
    frame #15: 0x000000010ffea28b mono-sgen64`mono_runtime_delegate_try_invoke [inlined] mono_runtime_invoke_checked(params=<unavailable>, error=<unavailable>) at object.c:3185 [opt]
    frame #16: 0x000000010ffea283 mono-sgen64`mono_runtime_delegate_try_invoke(delegate=0x000000011040e6e8, params=0x0000700001cccea8, exc=0x0000000000000000, error=0x0000700001ccce40) at object.c:4386 [opt]
    frame #17: 0x000000011000f68e mono-sgen64`start_wrapper at threads.c:1241 [opt]
    frame #18: 0x000000011000f5d3 mono-sgen64`start_wrapper(data=0x00007f90c1e16650) at threads.c:1294 [opt]
    frame #19: 0x00007fff7d920661 libsystem_pthread.dylib`_pthread_body + 340
    frame #20: 0x00007fff7d92050d libsystem_pthread.dylib`_pthread_start + 377
    frame #21: 0x00007fff7d91fbf9 libsystem_pthread.dylib`thread_start + 13
  thread #7, name = 'tid_5203'
    frame #0: 0x00007fff7d757ece libsystem_kernel.dylib`__accept + 10
    frame #1: 0x000000010ff3892c mono-sgen64`mono_w32socket_accept(sock=<unavailable>, addr=0x0000000000000000, addrlen=0x0000000000000000, blocking=<unavailable>) at w32socket-unix.c:169 [opt]
    frame #2: 0x000000010fff3cc2 mono-sgen64`ves_icall_System_Net_Sockets_Socket_Accept_internal(sock=<unavailable>, werror=0x0000700001ecf918, blocking=<unavailable>, error=<unavailable>) at w32socket.c:840 [opt]
    frame #3: 0x000000010ff93f12 mono-sgen64`ves_icall_System_Net_Sockets_Socket_Accept_internal_raw(a0=<unavailable>, a1=<unavailable>, a2=<unavailable>, error=0x0000700001ecf810) at icall-def.h:546 [opt]
    frame #4: 0x0000000115ce1369
    frame #5: 0x0000000115ce0aab
    frame #6: 0x0000000111dfc5db mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart_Context_object + 171
    frame #7: 0x0000000111df9e6a mscorlib.dll.dylib`System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 426
    frame #8: 0x0000000111df9c73 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 67
    frame #9: 0x0000000111df9be8 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object + 104
    frame #10: 0x0000000111dfc763 mscorlib.dll.dylib`System_Threading_ThreadHelper_ThreadStart + 67
    frame #11: 0x0000000112d5cf11
    frame #12: 0x000000010fdcac69 mono-sgen64`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x0000700001ecfea8, exc=0x0000000000000001, error=<unavailable>) at mini-runtime.c:3184 [opt]
    frame #13: 0x000000010ffe8254 mono-sgen64`do_runtime_invoke(method=0x00007f90c303e680, obj=0x00000001106b9520, params=0x0000700001ecfea8, exc=0x0000000000000000, error=0x0000700001ecfe40) at object.c:3017 [opt]
    frame #14: 0x000000010ffea28b mono-sgen64`mono_runtime_delegate_try_invoke [inlined] mono_runtime_invoke_checked(params=<unavailable>, error=<unavailable>) at object.c:3185 [opt]
    frame #15: 0x000000010ffea283 mono-sgen64`mono_runtime_delegate_try_invoke(delegate=0x00000001106b9520, params=0x0000700001ecfea8, exc=0x0000000000000000, error=0x0000700001ecfe40) at object.c:4386 [opt]

    frame #16: 0x000000011000f68e mono-sgen64`start_wrapper at threads.c:1241 [opt]
=================================================================
    frame #17: 0x000000011000f5d3 mono-sgen64`start_wrapper(data=0x00007f90c1f370b0) at threads.c:1294 [opt]
    Basic Fault Address Reporting
=================================================================
    frame #18: 0x00007fff7d920661 libsystem_pthread.dylib`_pthread_body + 340
    frame #19: 0x00007fff7d92050d libsystem_pthread.dylib`_pthread_start + 377
    frame #20: 0x00007fff7d91fbf9 libsystem_pthread.dylib`thread_start + 13
Memory around native instruction pointer (0x7fff7753e784):0x7fff7753e774  89 0b 89 f7 48 89 de e8 e1 82 fc ff 48 8b 43 18  ....H.......H.C.
0x7fff7753e784  49 89 46 18 48 8b 43 10 49 89 46 10 48 8b 03 48  I.F.H.C.I.F.H..H
(lldb) detach
Process 36950 detached
(lldb) quit
0x7fff7753e794  8b 4b 08 49 89 4e 08 49 89 06 48 8b 05 d3 18 55  .K.I.N.I..H....U
0x7fff7753e7a4  3d 48 8b 00 48 3b 45 e8 75 0c 4c 89 f0 48 83 c4  =H..H;E.u.L..H..

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at OpenTK.Platform.MacOS.Carbon.CG:DisplayBounds <0x000bc>
      at OpenTK.Platform.MacOS.QuartzDisplayDeviceDriver:.cctor <0x005c2>
      at System.Object:runtime_invoke_void <0x000a5>
      at <unknown> <0xffffffff>
      at System.Object:__icall_wrapper_mono_generic_class_init <0x00078>
      at OpenTK.Platform.MacOS.MacOSFactory:CreateDisplayDeviceDriver <0x0004a>
      at OpenTK.DisplayDevice:.cctor <0x000ba>
      at System.Object:runtime_invoke_void <0x000a5>
      at <unknown> <0xffffffff>
      at OpenTK.Graphics.GraphicsMode:get_Default <0x000f2>
      at OpenTK.GameWindow:.ctor <0x00042>
      at Interpreter.Libraries.Game.GameWindow:.ctor <0x0013a>
      at Interpreter.Libraries.Game.GameWindow:InitializeScreen <0x000a2>
      at Interpreter.Libraries.Game.LibraryWrapper:lib_game_initialize_screen <0x0016a>
      at <Module>:runtime_invoke_object_object_object <0x000b4>
      at <unknown> <0xffffffff>
      at System.Reflection.RuntimeMethodInfo:InternalInvoke <0x00091>
      at System.Reflection.RuntimeMethodInfo:Invoke <0x00116>
      at System.Reflection.MethodBase:Invoke <0x00047>
      at <RegisterLibraryMethodResolver>c__AnonStorey1:<>m__1 <0x000c2>
      at Interpreter.Vm.CrayonWrapper:interpretImpl <0x0cd81>
      at Interpreter.Vm.CrayonWrapper:interpret <0x00052>
      at Interpreter.Vm.CrayonWrapper:runInterpreter <0x0005a>
      at Interpreter.Vm.TranslationHelper:HandleInterpreterStatus <0x001aa>
      at Interpreter.Vm.TranslationHelper:StartInterpreter <0x0007a>
      at CrayonRuntime.Program:Run <0x00c1a>
      at CrayonRuntime.Program:Main <0x0004a>
      at <Module>:runtime_invoke_void_object <0x000b0>
=================================================================
TimJSwan89 commented 5 years ago

Nevermind... umm actually, this was the result of me having my alias reverted. Apparently mono acts strangely when given what looks like a folder as a command. 3

I suppose the only use for this issue now is that it perhaps provides a bit of argument against the use of mono. 😅

TimJSwan89 commented 5 years ago

Using mono with a mac can be done certain ways. I noticed that I can get things to work when there are filepaths with spaces with code which looks like the following:

export CRAYON_HOME='/Path/With A/Space/crayon-2.1.0-mono'
export PATH="$CRAYON_HOME:$PATH"
alias crayon='mono "$CRAYON_HOME/crayon.exe"'

Originally, I only had the last line as:

alias crayon='mono $CRAYON_HOME/crayon.exe'

And possibly double quotes on the first line. Point is, there are things that seem to work in bash which don't actually work anymore when a filepath has a space, but then there is another way to do things so that it even works then.