Отладка Сегментация неисправность моно - PullRequest
0 голосов
/ 30 января 2019

У меня есть большое приложение для Windows, которое я пытаюсь преобразовать в приложение для Linux.После компиляции требуемой Windows DLL как lib.so для Linux и запуска его в моно я получаю следующую ошибку.Мне нужно знать, как я могу отладить и найти причину этой ошибки.Ранее у меня были такие ошибки, но я получил какую-то ошибку из lib.so, так что я смог отладить ошибку.Но не в этот раз.

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.copy_from_unmanaged (intptr,int,System.Array,int) [0x00000] in <e6f8e24d53ce4b77958e0012c63a6a21>:0
  at System.Runtime.InteropServices.Marshal.Copy (intptr,byte[],int,int) [0x00000] in <e6f8e24d53ce4b77958e0012c63a6a21>:0
  at Efs.EfsInterface.Efs_Callback (uint,uint,uint,intptr) [0x0008b] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at (wrapper native-to-managed) Efs.EfsInterface.Efs_Callback (uint,uint,uint,intptr) <0x0007f>
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Efs.EfsApi.EFS_Init (uint,uint,uint,Efs.CallBack) [0x0000a] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at Efs.EfsInterface.Init (uint,EfsImages.EfsImage) [0x00011] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at Efs_Image.Programm.CreateEfsImage () [0x0003b] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at Efs_Image.Programm.Run (string[]) [0x00017] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at Efs_Image.efsimage.Main (string[]) [0x00007] in <d600cd10d3ab49d9976894a5e7d08472>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00054] in <d600cd10d3ab49d9976894a5e7d08472>:0
/proc/self/maps:
00400000-00812000 r-xp 00000000 08:01 1198214                            /usr/local/bin/mono-sgen
00a12000-00a19000 r--p 00412000 08:01 1198214                            /usr/local/bin/mono-sgen
00a19000-00a1e000 rw-p 00419000 08:01 1198214                            /usr/local/bin/mono-sgen
00a1e000-00a34000 rw-p 00000000 00:00 0 
00ff6000-0115d000 rw-p 00000000 00:00 0                                  [heap]
40b4a000-40b5a000 rwxp 00000000 00:00 0 
40ef7000-40f07000 rwxp 00000000 00:00 0 
7fce40000000-7fce40021000 rw-p 00000000 00:00 0 
7fce40021000-7fce44000000 ---p 00000000 00:00 0 
7fce446ff000-7fce46600000 rw-p 00000000 00:00 0 
7fce4660c000-7fce4664f000 r-xp 00000000 08:31 3827725                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libefs.so
7fce4664f000-7fce4684f000 ---p 00043000 08:31 3827725                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libefs.so
7fce4684f000-7fce46850000 r--p 00043000 08:31 3827725                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libefs.so
7fce46850000-7fce46851000 rw-p 00044000 08:31 3827725                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libefs.so
7fce46851000-7fce46871000 rw-p 00000000 00:00 0 
7fce46871000-7fce46891000 r-xp 00000000 08:31 3827700                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libmcfg.so
7fce46891000-7fce46a91000 ---p 00020000 08:31 3827700                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libmcfg.so
7fce46a91000-7fce46a92000 r--p 00020000 08:31 3827700                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libmcfg.so
7fce46a92000-7fce46a93000 rw-p 00021000 08:31 3827700                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libmcfg.so
7fce46a93000-7fce46a94000 rw-p 00000000 00:00 0 
7fce46a94000-7fce46aae000 r-xp 00000000 08:31 3827709                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libnv.so
7fce46aae000-7fce46cad000 ---p 0001a000 08:31 3827709                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libnv.so
7fce46cad000-7fce46cae000 r--p 00019000 08:31 3827709                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libnv.so
7fce46cae000-7fce46caf000 rw-p 0001a000 08:31 3827709                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/libnv.so
7fce46caf000-7fce46cb7000 rw-p 00000000 00:00 0 
7fce46cb7000-7fce46cc0000 ---p 00000000 00:00 0 
7fce46cc0000-7fce46eb8000 rw-p 00000000 00:00 0 
7fce46eb8000-7fce47606000 r-xp 00000000 08:01 3278545                    /usr/local/lib/mono/4.5/mscorlib.dll.so
7fce47606000-7fce47805000 ---p 0074e000 08:01 3278545                    /usr/local/lib/mono/4.5/mscorlib.dll.so
7fce47805000-7fce47806000 rw-p 0074d000 08:01 3278545                    /usr/local/lib/mono/4.5/mscorlib.dll.so
7fce47806000-7fce4782d000 rw-p 00000000 00:00 0 
7fce4782d000-7fce47bff000 r--p 00000000 08:01 3278543                    /usr/local/lib/mono/4.5/mscorlib.dll
7fce47bff000-7fce48bff000 rw-p 00000000 00:00 0 
7fce48bff000-7fce48c00000 ---p 00000000 00:00 0 
7fce48c00000-7fce49800000 rw-p 00000000 00:00 0 
7fce498e7000-7fce49aa5000 r-xp 00000000 08:01 3044156                    /lib/x86_64-linux-gnu/libc-2.19.so
7fce49aa5000-7fce49ca5000 ---p 001be000 08:01 3044156                    /lib/x86_64-linux-gnu/libc-2.19.so
7fce49ca5000-7fce49ca9000 r--p 001be000 08:01 3044156                    /lib/x86_64-linux-gnu/libc-2.19.so
7fce49ca9000-7fce49cab000 rw-p 001c2000 08:01 3044156                    /lib/x86_64-linux-gnu/libc-2.19.so
7fce49cab000-7fce49cb0000 rw-p 00000000 00:00 0 
7fce49cb0000-7fce49cc6000 r-xp 00000000 08:01 3043915                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fce49cc6000-7fce49ec5000 ---p 00016000 08:01 3043915                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fce49ec5000-7fce49ec6000 rw-p 00015000 08:01 3043915                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fce49ec6000-7fce49edf000 r-xp 00000000 08:01 3044148                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7fce49edf000-7fce4a0de000 ---p 00019000 08:01 3044148                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7fce4a0de000-7fce4a0df000 r--p 00018000 08:01 3044148                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7fce4a0df000-7fce4a0e0000 rw-p 00019000 08:01 3044148                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7fce4a0e0000-7fce4a0e4000 rw-p 00000000 00:00 0 
7fce4a0e4000-7fce4a0e7000 r-xp 00000000 08:01 3044152                    /lib/x86_64-linux-gnu/libdl-2.19.so
7fce4a0e7000-7fce4a2e6000 ---p 00003000 08:01 3044152                    /lib/x86_64-linux-gnu/libdl-2.19.so
7fce4a2e6000-7fce4a2e7000 r--p 00002000 08:01 3044152                    /lib/x86_64-linux-gnu/libdl-2.19.so
7fce4a2e7000-7fce4a2e8000 rw-p 00003000 08:01 3044152                    /lib/x86_64-linux-gnu/libdl-2.19.so
7fce4a2e8000-7fce4a2ef000 r-xp 00000000 08:01 3044149                    /lib/x86_64-linux-gnu/librt-2.19.so
7fce4a2ef000-7fce4a4ee000 ---p 00007000 08:01 3044149                    /lib/x86_64-linux-gnu/librt-2.19.so
7fce4a4ee000-7fce4a4ef000 r--p 00006000 08:01 3044149                    /lib/x86_64-linux-gnu/librt-2.19.so
7fce4a4ef000-7fce4a4f0000 rw-p 00007000 08:01 3044149                    /lib/x86_64-linux-gnu/librt-2.19.so
7fce4a4f0000-7fce4a5f5000 r-xp 00000000 08:01 3044142                    /lib/x86_64-linux-gnu/libm-2.19.so
7fce4a5f5000-7fce4a7f4000 ---p 00105000 08:01 3044142                    /lib/x86_64-linux-gnu/libm-2.19.so
7fce4a7f4000-7fce4a7f5000 r--p 00104000 08:01 3044142                    /lib/x86_64-linux-gnu/libm-2.19.so
7fce4a7f5000-7fce4a7f6000 rw-p 00105000 08:01 3044142                    /lib/x86_64-linux-gnu/libm-2.19.so
7fce4a7f6000-7fce4a819000 r-xp 00000000 08:01 3044145                    /lib/x86_64-linux-gnu/ld-2.19.so
7fce4a8ac000-7fce4a998000 rw-p 00000000 00:00 0 
7fce4a998000-7fce4a9a0000 r--p 00000000 08:31 3810445                    /home/ubuntu/xhome/beryl2-git-poc/fw/HY11/common/tools/efsimage/efsimage.exe
7fce4a9a0000-7fce4a9a1000 rw-p 00000000 00:00 0 
7fce4a9a1000-7fce4aa00000 ---p 00000000 00:00 0 
7fce4aa00000-7fce4aa07000 rw-p 00000000 00:00 0 
7fce4aa07000-7fce4aa17000 rw-p 00000000 00:00 0 
7fce4aa17000-7fce4aa18000 rw-s 00000000 00:16 10                         /run/shm/mono.23539
7fce4aa18000-7fce4aa19000 r--p 00022000 08:01 3044145                    /lib/x86_64-linux-gnu/ld-2.19.so
7fce4aa19000-7fce4aa1a000 rw-p 00023000 08:01 3044145                    /lib/x86_64-linux-gnu/ld-2.19.so
7fce4aa1a000-7fce4aa1b000 rw-p 00000000 00:00 0 
7ffda71a6000-7ffda71ae000 ---p 00000000 00:00 0 
7ffda7984000-7ffda79a5000 rw-p 00000000 00:00 0                          [stack]
7ffda79e5000-7ffda79e8000 r--p 00000000 00:00 0                          [vvar]
7ffda79e8000-7ffda79ea000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Native stacktrace:

    mono() [0x4bb8b3]
    mono() [0x52f070]
    /lib/x86_64-linux-gnu/libc.so.6(+0x9aa50) [0x7fce49981a50]

Debug info from gdb:

warning: File "/usr/local/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /usr/local/bin/mono-sgen-gdb.py
line to your configuration file "/home/ubuntu/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/home/ubuntu/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path"
[New LWP 23541]
[New LWP 23540]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fce49ed5ed9 in __libc_waitpid (pid=pid@entry=23542, stat_loc=stat_loc@entry=0x7ffda79a18bc, options=options@entry=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 
  3    Thread 0x7fce493ff700 (LWP 23540) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  2    Thread 0x7fce46eb7700 (LWP 23541) "Finalizer" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
* 1    Thread 0x7fce4aa00780 (LWP 23539) "mono" 0x00007fce49ed5ed9 in __libc_waitpid (pid=pid@entry=23542, stat_loc=stat_loc@entry=0x7ffda79a18bc, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40

Thread 3 (Thread 0x7fce493ff700 (LWP 23540)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000006c4583 in mono_os_cond_wait (mutex=0xa319a0 <lock>, cond=0xa31960 <work_cond>) at ../../mono/utils/mono-os-mutex.h:173
#2  get_work (job=<synthetic pointer>, do_idle=<synthetic pointer>, work_context=<synthetic pointer>, worker_index=0) at sgen-thread-pool.c:165
#3  thread_func (data=<optimized out>) at sgen-thread-pool.c:196
#4  0x00007fce49ece184 in start_thread (arg=0x7fce493ff700) at pthread_create.c:312
#5  0x00007fce499e503d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7fce46eb7700 (LWP 23541)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x000000000066058c in mono_os_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0xa22b20 <finalizer_sem>) at ../../mono/utils/mono-os-semaphore.h:209
#2  mono_coop_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0xa22b20 <finalizer_sem>) at ../../mono/utils/mono-coop-semaphore.h:43
#3  finalizer_thread (unused=unused@entry=0x0) at gc.c:903
#4  0x0000000000619fc3 in start_wrapper_internal (stack_ptr=<optimized out>, start_info=0x0) at threads.c:1098
#5  start_wrapper (data=0x104ff80) at threads.c:1158
#6  0x00007fce49ece184 in start_thread (arg=0x7fce46eb7700) at pthread_create.c:312
#7  0x00007fce499e503d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7fce4aa00780 (LWP 23539)):
#0  0x00007fce49ed5ed9 in __libc_waitpid (pid=pid@entry=23542, stat_loc=stat_loc@entry=0x7ffda79a18bc, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40
#1  0x00000000004bb97c in mono_handle_native_crash (signal=signal@entry=0x6ed6ac "SIGSEGV", ctx=ctx@entry=0x0, info=info@entry=0x0) at mini-exceptions.c:3048
#2  0x000000000052f070 in altstack_handle_and_restore (ctx=0x7ffda79a23f0, obj=0x0, stack_ovf=0) at exceptions-amd64.c:855
#3  0x00007fce49981a50 in __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:32
#4  0x0000000000000000 in ?? ()

=================================================================
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.
=================================================================

*****NO NULL**** 468508e0Aborted (core dumped)

...