Hi @all, 

I use Mono JIT compiler version 5.4.0.135 on my Raspberry Pi but I think
this is a more common problem / bug which could be related to Linux systems.

I have a PS3 controller attached over Bluetooth which generates a Device
file /dev/input/js0. You can read this device as shown in this code: 
http://mpolaczyk.pl/raspberry-pi-mono-c-joystick-handler/

It works really nice. But when you run the program and switch off the PS3
controller the device file is gone. And then you get this error / stack
trace: 
-> See bottom of this mail. 

I tried to catch that error in the following way: 
                try
                {
                    fs.Read(buff, 0, 8);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
But it won´t work. 

Is this a general but in Mono? Maybe exception handling isn´t complete in
System.IO.MonoIO.Read ?
Would be great if anyone can give some advice. 

Regards
   Dominik

-------
w32error-unix.c: unknown error (19) "No such device"
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.IO.MonoIO.Read
(intptr,byte[],int,int,System.IO.MonoIOError&) <0x0004b>
  at System.IO.MonoIO.Read
(System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOEr
ror&) [0x00010] in <dd026cff67c145fd803d52e54da26efb>:0
  at System.IO.FileStream.ReadData
(System.Runtime.InteropServices.SafeHandle,byte[],int,int) [0x00002] in
<dd026cff67c145fd803d52e54da26efb>:0
  at System.IO.FileStream.RefillBuffer () [0x00006] in
<dd026cff67c145fd803d52e54da26efb>:0
  at System.IO.FileStream.ReadInternal (byte[],int,int) [0x00049] in
<dd026cff67c145fd803d52e54da26efb>:0
  at System.IO.FileStream.Read (byte[],int,int) [0x000a1] in
<dd026cff67c145fd803d52e54da26efb>:0
  at Program.Main (string[]) [0x0009c] in
<26393b4282f94cf39b0963c55aa38cd2>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) [0x0004e] in
<26393b4282f94cf39b0963c55aa38cd2>:0
/proc/self/maps:
00010000-00339000 r-xp 00000000 b3:02 43829      /usr/bin/mono-sgen
00348000-00349000 r--p 00328000 b3:02 43829      /usr/bin/mono-sgen
00349000-0034b000 rw-p 00329000 b3:02 43829      /usr/bin/mono-sgen
0034b000-00377000 rw-p 00000000 00:00 0
00cd7000-00de2000 rw-p 00000000 00:00 0          [heap]
b4000000-b4021000 rw-p 00000000 00:00 0
b4021000-b4100000 ---p 00000000 00:00 0
b41a0000-b482c000 r-xp 00000000 b3:02 257930
/usr/lib/mono/aot-cache/arm/mscorlib.dll.so
b482c000-b483b000 ---p 0068c000 b3:02 257930
/usr/lib/mono/aot-cache/arm/mscorlib.dll.so
b483b000-b483c000 rw-p 0068b000 b3:02 257930
/usr/lib/mono/aot-cache/arm/mscorlib.dll.so
b483c000-b484a000 rw-p 00000000 00:00 0
b484a000-b4c00000 r--p 00000000 b3:02 257788
/usr/lib/mono/4.5/mscorlib.dll
b4c00000-b5400000 rw-p 00000000 00:00 0
b5400000-b5401000 ---p 00000000 00:00 0
b5401000-b5c00000 rwxp 00000000 00:00 0
b5c00000-b6000000 rw-p 00000000 00:00 0
b6134000-b6135000 ---p 00000000 00:00 0
b6135000-b6234000 rwxp 00000000 00:00 0
b6234000-b62b4000 rw-p 00000000 00:00 0
b62b5000-b62c5000 rwxp 00000000 00:00 0
b62c5000-b62c6000 ---p 00000000 00:00 0
b62c6000-b6ac5000 rwxp 00000000 00:00 0
b6ac5000-b6ac6000 rw-p 00000000 00:00 0
b6ac6000-b6af5000 ---p 00000000 00:00 0
b6af5000-b6c7e000 r--p 00000000 b3:02 11469
/usr/lib/locale/locale-archive
b6c7e000-b6da9000 r-xp 00000000 b3:02 1946
/lib/arm-linux-gnueabihf/libc-2.19.so
b6da9000-b6db9000 ---p 0012b000 b3:02 1946
/lib/arm-linux-gnueabihf/libc-2.19.so
b6db9000-b6dbb000 r--p 0012b000 b3:02 1946
/lib/arm-linux-gnueabihf/libc-2.19.so
b6dbb000-b6dbc000 rw-p 0012d000 b3:02 1946
/lib/arm-linux-gnueabihf/libc-2.19.so
b6dbc000-b6dbf000 rw-p 00000000 00:00 0
b6dbf000-b6ddc000 r-xp 00000000 b3:02 1959
/lib/arm-linux-gnueabihf/libgcc_s.so.1
b6ddc000-b6deb000 ---p 0001d000 b3:02 1959
/lib/arm-linux-gnueabihf/libgcc_s.so.1
b6deb000-b6dec000 rw-p 0001c000 b3:02 1959
/lib/arm-linux-gnueabihf/libgcc_s.so.1
b6dec000-b6e00000 r-xp 00000000 b3:02 2006
/lib/arm-linux-gnueabihf/libpthread-2.19.so
b6e00000-b6e10000 ---p 00014000 b3:02 2006
/lib/arm-linux-gnueabihf/libpthread-2.19.so
b6e10000-b6e11000 r--p 00014000 b3:02 2006
/lib/arm-linux-gnueabihf/libpthread-2.19.so
b6e11000-b6e12000 rw-p 00015000 b3:02 2006
/lib/arm-linux-gnueabihf/libpthread-2.19.so
b6e12000-b6e14000 rw-p 00000000 00:00 0
b6e14000-b6e16000 r-xp 00000000 b3:02 1954
/lib/arm-linux-gnueabihf/libdl-2.19.so
b6e16000-b6e25000 ---p 00002000 b3:02 1954
/lib/arm-linux-gnueabihf/libdl-2.19.so
b6e25000-b6e26000 r--p 00001000 b3:02 1954
/lib/arm-linux-gnueabihf/libdl-2.19.so
b6e26000-b6e27000 rw-p 00002000 b3:02 1954
/lib/arm-linux-gnueabihf/libdl-2.19.so
b6e27000-b6e2d000 r-xp 00000000 b3:02 2009
/lib/arm-linux-gnueabihf/librt-2.19.so
b6e2d000-b6e3c000 ---p 00006000 b3:02 2009
/lib/arm-linux-gnueabihf/librt-2.19.so
b6e3c000-b6e3d000 r--p 00005000 b3:02 2009
/lib/arm-linux-gnueabihf/librt-2.19.so
b6e3d000-b6e3e000 rw-p 00006000 b3:02 2009
/lib/arm-linux-gnueabihf/librt-2.19.so
b6e3e000-b6ea7000 r-xp 00000000 b3:02 1972
/lib/arm-linux-gnueabihf/libm-2.19.so
b6ea7000-b6eb7000 ---p 00069000 b3:02 1972
/lib/arm-linux-gnueabihf/libm-2.19.so
b6eb7000-b6eb8000 r--p 00069000 b3:02 1972
/lib/arm-linux-gnueabihf/libm-2.19.so
b6eb8000-b6eb9000 rw-p 0006a000 b3:02 1972
/lib/arm-linux-gnueabihf/libm-2.19.so
b6eb9000-b6ebc000 rw-p 00000000 00:00 0
b6ebc000-b6ebd000 r--p 00000000 b3:02 19714
/usr/share/locale/en_GB/LC_MESSAGES/libc.mo
b6ebd000-b6ecd000 rwxp 00000000 00:00 0
b6ecd000-b6ed2000 r-xp 00000000 b3:02 10212
/usr/lib/arm-linux-gnueabihf/libarmmem.so
b6ed2000-b6ee1000 ---p 00005000 b3:02 10212
/usr/lib/arm-linux-gnueabihf/libarmmem.so
b6ee1000-b6ee2000 rw-p 00004000 b3:02 10212
/usr/lib/arm-linux-gnueabihf/libarmmem.so
b6ee2000-b6f02000 r-xp 00000000 b3:02 1914
/lib/arm-linux-gnueabihf/ld-2.19.so
b6f02000-b6f04000 r--p 00000000 b3:02 135882
/home/pi/pieasy/PS3_Values.exe
b6f04000-b6f0a000 rw-p 00000000 00:00 0
b6f0a000-b6f0b000 rw-s 00000000 00:10 11754      /dev/shm/mono.864
b6f0b000-b6f0c000 ---p 00000000 00:00 0
b6f0c000-b6f0d000 r--p 00000000 00:00 0
b6f0d000-b6f11000 rw-p 00000000 00:00 0
b6f11000-b6f12000 r--p 0001f000 b3:02 1914
/lib/arm-linux-gnueabihf/ld-2.19.so
b6f12000-b6f13000 rw-p 00020000 b3:02 1914
/lib/arm-linux-gnueabihf/ld-2.19.so
bef44000-bef65000 rwxp 00000000 00:00 0          [stack]
bef80000-bef81000 r-xp 00000000 00:00 0          [sigpage]
ffff0000-ffff1000 r-xp 00000000 00:00 0          [vectors]

Native stacktrace:


Debug info from gdb:

Cannot access memory at address 0xe
Mono support loaded.
[New LWP 869]
[New LWP 866]
[New LWP 865]
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/arm-linux-gnueabihf/libthread_db.so.1".
0xb6dfbef8 in __libc_waitpid (pid=875, pid@entry=<error reading variable:
Cannot access memory at address 0xe>, stat_loc=0xbef63208, options=0) at
../sysdeps/unix/sysv/linux/waitpid.c:40
40      ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
  Id   Target Id         Frame
  4    Thread 0xb6ac4450 (LWP 865) "SGen worker" 0xb6df77a4 in
__pthread_cond_wait (Cannot access memory at address 0x1
cond=0x376438, mutex=0x376420) at pthread_cond_wait.c:187
  3    Thread 0xb5bff450 (LWP 866) "SGen worker" 0xb6df77a4 in
__pthread_cond_wait (Cannot access memory at address 0x1
cond=0x375760, mutex=0x375748) at pthread_cond_wait.c:187
  2    Thread 0xb6233450 (LWP 869) "Finalizer" 0xb6df9a40 in do_futex_wait
(isem=isem@entry=0x36d83c) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
* 1    Thread 0xb6f0d000 (LWP 864) "mono" 0xb6dfbef8 in __libc_waitpid
(pid=875, pid@entry=<error reading variable: Cannot access memory at address
0xe>, stat_loc=0xbef63208, options=0) at
../sysdeps/unix/sysv/linux/waitpid.c:40

Thread 4 (Thread 0xb6ac4450 (LWP 865)):
Cannot access memory at address 0x1
#0  0xb6df77a4 in __pthread_cond_wait (cond=0x376438, mutex=0x376420) at
pthread_cond_wait.c:187
#1  0x0025e2dc in ?? ()
Cannot access memory at address 0x1
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 3 (Thread 0xb5bff450 (LWP 866)):
Cannot access memory at address 0x1
#0  0xb6df77a4 in __pthread_cond_wait (cond=0x375760, mutex=0x375748) at
pthread_cond_wait.c:187
#1  0x0025e29c in ?? ()
Cannot access memory at address 0x1
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0xb6233450 (LWP 869)):
#0  0xb6df9a40 in do_futex_wait (isem=isem@entry=0x36d83c) at
../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48
#1  0xb6df9af4 in __new_sem_wait (sem=0x36d83c) at
../nptl/sysdeps/unix/sysv/linux/sem_wait.c:69
#2  0x001dc1e0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0xb6f0d000 (LWP 864)):
Python Exception <class 'gdb.MemoryError'> Cannot access memory at address
0xe:
#0  0xb6dfbef8 in __libc_waitpid (pid=875, stat_loc=0xbef63208, options=0)
at ../sysdeps/unix/sysv/linux/waitpid.c:40
#1  0x000b716c in ?? ()
/home/pi/dev/gdb-7.7.1+dfsg/gdb/frame.c:472: internal-error: get_frame_id:
Assertion `fi->this_id.p' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
/home/pi/dev/gdb-7.7.1+dfsg/gdb/frame.c:472: internal-error: get_frame_id:
Assertion `fi->this_id.p' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]

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

_______________________________________________
Mono-list maillist  -  Mono-list@lists.dot.net
http://lists.dot.net/mailman/listinfo/mono-list

Reply via email to