[Mono-dev] Terminal config for mono csharp shell?

Cyd Haselton chaselton at gmail.com
Fri Jun 12 09:43:19 UTC 2015


No need to apologize...busy here too.

I was wrong about asm/ioctl.h BTW.  Right now i'm going through console-unix.c  to figure out what is causing the crash.  Slow work, as i'm not familiar with signal handling at all.

Here's the rest of the strace output, just in case it is helpful. 

27045 00:02:27 --- SIGWINCH (Window changed) @ 0 (0) ---                             27045 00:02:27 ioctl(0, TIOCGWINSZ, {ws_row=59, ws_col=85, ws_xpixel=0, ws_ypixel=0}) = 0
27045 00:02:27 --- SIGSEGV (Segmentation fault) @ 0 (0) ---                          27045 00:02:27 open("/data/data/jackpal.androidterm/kbox2/dev/log/main", O_WRONLY|O_LARGEFILE|0x80000) = 4                                                                27045 00:02:27 open("/data/data/jackpal.androidterm/kbox2/dev/log/radio", O_WRONLY|O_LARGEFILE|0x80000) = 5                                                               27045 00:02:27 open("/data/data/jackpal.androidterm/kbox2/dev/log/events", O_WRONLY|O_LARGEFILE|0x80000) = 6                                                              27045 00:02:27 open("/data/data/jackpal.androidterm/kbox2/dev/log/system", O_WRONLY|O_LARGEFILE|0x80000) = 7                                                              27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"Stacktrace:\n\n\0", 14}], 3) = 23                                                                                27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at
<unknown> <0xffffffff>\n\0", 29}], 3) = 38                                                                  27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at (wrapper managed-to-native) System.IO.MonoIO.Read (intptr,byte[],int,int,System.IO.MonoIOError&) <0xffffffff>\n\0", 116}], 3) = 125
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.MonoIO.Read (System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOError&) <0x0006f>\n\0", 120}], 3) = 129                                                          27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.FileStream.ReadData (System.Runtime.InteropServices.SafeHandle,byte[],int,int) <0x00047>\n\0", 105}], 3) = 114                                                                         27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.FileStream.ReadInternal (byte[],int,int) <0x00087>\n\0", 67}], 3) = 76                            27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.FileStream.Read (byte[],int,int) <0x000ef>\n\0", 59}], 3) = 68                                    27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.StreamReader.ReadBuffer () <0x0035f>\n\0", 53}], 3) = 62                   
                      27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.IO.StreamReader.Read () <0x0005f>\n\0", 47}], 3) = 56                                                27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.TermInfoDriver.ReadKeyInternal (bool&) <0x00113>\n\0", 62}], 3) = 71                                 27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.TermInfoDriver.ReadKey (bool) <0x0002b>\n\0", 53}], 3) = 62                                          27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.ConsoleDriver.ReadKey (bool) <0x00037>\n\0", 52}], 3) = 61                                           27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at System.Console.ReadKey (bool) <0x0001b>\n\0", 46}], 3) = 55
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.Terminal.LineEditor.EditLoop () <0x0006b>\n\0", 53}], 3) = 62
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.Terminal.LineEditor.Edit (string,string) <0x00157>\n\0", 62}], 3) = 71
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.CSharpShell.GetLine (bool) <0x00093>\n\0", 48}], 3) = 57
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.CSharpShell.ReadEvalPrintLoopWith (Mono.CSharpShell/ReadLiner) <0x0002f>\n\0", 84}], 3) = 93
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.CSharpShell.ReadEvalPrintLoop () <0x001a7>\n\0", 54}], 3) = 63
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.CSharpShell.Run (string[]) <0x00033>\n\0", 48}], 3) = 57
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at Mono.Driver.Main (string[]) <0x0041f>\n\0", 44}], 3) = 53
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>\n\0", 109}], 3) = 118
27045 00:02:27 writev(4, [{"\6", 1}, {"mono-rt\0", 8}, {"\n=================================================================\nGot a SIGSEGV while executing native code. This usually indicates\na fatal error in the mono runtime or one of the native libraries \nused by your application.\n=================================================================\n\n\0", 293}], 3) = 302
27045 00:02:27 sigaction(SIGABRT, {SIG_DFL}, NULL, 0x15980b8) = 0

**snip**

On June 12, 2015 1:02:49 AM CDT, Robert N <sushihangover at outlook.com> wrote:
>
>Sorry, been swamped... I'm not sure about the outclass.h, I'll have to
>take a look... I do know that resizing the csharp repo on os-x's
>terminal causes havoc on the its output and the input/output cursor is
>incorrectly moved, that that point it is taking input and sending out
>to the wrong line of the window, but it does not crash as in your case.
>
>> Date: Wed, 10 Jun 2015 11:20:46 -0500
>> Subject: Re: [Mono-dev] Terminal config for mono csharp shell?
>> From: chaselton at gmail.com
>> To: sushihangover at outlook.com
>> CC: mono-devel-list at lists.ximian.com
>> 
>> I'm revisiting this because I uncovered a larger, possibly related,
>> problem with running the newly built csharp REPL.
>> 
>> When resizing the terminal, csharp exits unexpectedly.  Running
>strace
>> in a separate terminal and attaching it to the csharp PID shows the
>> csharp REPL segfaulting when the terminal is resized (at
>> SIGWINCH...specifically right after the following line is
>> called/executed:
>> 
>> ioctl(0, TIOCGWINSZ, {ws_row=59, ws_col=85, ws_xpixel=0,
>ws_ypixel=0}) = 0
>> 
>> My sysroot has an asm/ioctls.h...I'm guessing that it needs to be
>> added to console-unix.c or console-io.c...possibly both.  Am I in the
>> right ballpark?
>> 
>> On Sat, Jun 6, 2015 at 10:41 PM, Robert N <sushihangover at outlook.com>
>wrote:
>> >
>> >
>> > stty sane make sense in terms of a TERM=linux and either a messed
>up/missing termcap and/or missing capabilities during autogen/configure
>and shell that is not quite right...
>> >
>> > The fact that the console.unix.c works across all the std linux
>flavors and os-x would suggest that something in your environment is
>different. Not sure what your 'droid dev environment is like, but if
>you can build/debug mono, you can look at how it is init & exiting in
>the app-domain.c/console-io.c/console-unix.c routines.
>> >
>> > It should 'just work', but that requires a very clean environment
>as Mono does an very generic (iffy IMHO) job of tty exiting (also
>init'ing).  If you look at the ConsoleDriver the extent of the tty
>exit/teardown is 'string' that is sent is a hardcoded DC1 signal (0x11)
>which is Ctrl-Q (XON). You can browse the native driver function in
>console-unix.c, it is running on a gc'd thread, the std c lib function
>atexit is called with the tty teardown function and it does a very
>generic teardown (flushing the pipes and setting the ECHO env to true).
>> >
>> > Is this right or wrong? Depends upon who you ask ;-) Programs
>written in python have this this issue all the time with using no echo
>tty mode and properly exiting, it is usually a threading issue, but
>hard to prevent. A lot of P-coders just place an os.system('stty sane')
>in their exit code, perl coders place system("stty sane");  curses
>users should always use endwin(); reset(); to clean things up, etc...
>> >
>> > The fact that the console.unix.c works across all the std linux
>flavors and os-x would suggest that something in your environment is
>different. Not sure what your 'droid dev environment is like, but if
>you can build/debug mono, you can look at how it is init & exiting in
>the app-domain.c/console-io.c/console-unix.c routines.
>> >
>> > ________________________________
>> > From: chaselton at gmail.com
>> > Date: Sat, 6 Jun 2015 19:39:16 -0500
>> > To: mono-devel-list at lists.ximian.com
>> > Subject: Re: [Mono-dev] Terminal config for mono csharp shell?
>> >
>> > Additionally, running 'stty sane' after exiting the REPL solves the
>problem. Maybe there is a way to set the REPL to run a command on
>quitting?
>> >
>> > On June 6, 2015 8:04:47 AM CDT, Cyd Haselton <chaselton at gmail.com>
>wrote:
>> >
>> > Are there any special terminal and/or shell settings I should set
>for the csharp shell?
>> >
>> > csharp works okay...minus some cursor jumping...but after quitting
>the console shell behaves oddly until I exit it and re-enter.
>> >
>> > Example:
>> > /home/kbox $ csharp
>> > Mono C# Shell, type "help;" for help
>> > Enter statements below.
>> > csharp> DateTime.Now 06/06/2015 13:00:31
>> > csharp> help "Static methods:
>> > Describe (object); - Describes the object's type
>> > LoadPackage (package); - Loads the given Package (like -pkg:FILE)
>> > LoadAssembly (assembly); - Loads the given assembly (like
>-r:ASSEMBLY)
>> > ShowVars (); - Shows defined local variables.
>> > ShowUsing (); - Show active using declarations.
>> > Prompt - The prompt used by the C# shell
>> > ContinuationPrompt - The prompt for partial input
>> > Time (() => { }); - Times the specified code
>> > print (obj); - Shorthand for Console.WriteLine
>> > quit; - You'll never believe it - this quits the repl!
>> > help; - This help text
>> > TabAtStartCompletes - Whether tab will complete even on empty lines
>> > "
>> > csharp> quit
>> >
>> > Environment shell after quitting:
>> > /home/kbox $ /home/kbox $ /home/kbox $ /home/kbox $ /home/kbox $
>/home/kbox $ /home/kbox $ >
>/data/data/jackpal.androidterm/kbox2/bin/bash: \: not found
>> > /home/kbox $ /home/kbox $ /home/kbox $ /home/kbox $ /home/kbox $
>/home/kbox $
>> >
>> > After exiting environment shell...you can't see the 'exit' command
>I typed:
>> > /home/kbox $ 127|u0_a186 at altev:/ $
>> > 127|u0_a186 at altev:/ $
>> > 127|u0_a186 at altev:/ $
>> > 127|u0_a186 at altev:/ $
>> > 127|u0_a186 at altev:/ $
>> >
>> > Re-entering the environment shell:
>> > 127|u0_a186 at altev:/ $
>/data/data/jackpal.androidterm/kbox2/bin/kbox_shell
>> > /home/kbox $
>> > /home/kbox $
>> > /home/kbox $
>> > /home/kbox $
>> >
>> >
>> > --
>> > Sent from my Android device with K-9 Mail. Please excuse my
>brevity.
>> > _______________________________________________ Mono-devel-list
>mailing list Mono-devel-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 		 	   		  



More information about the Mono-devel-list mailing list