mono / sdb

A command line client for the Mono soft debugger.
https://www.mono-project.com
MIT License
116 stars 44 forks source link

drop sdb when resize window #45

Closed callmekohei closed 6 years ago

callmekohei commented 6 years ago

Hello again! I'm callmekohei!

see also : https://github.com/mono/mono/issues/6442#issuecomment-355925697

Steps to Reproduce

  1. start vim8
  2. start sdb in vim8's terminal
  3. move window pane

like this

untitled

Current Behavior

drop mono debugger client

Expected Behavior

not drop mono debugger client

On which platforms did you notice this

[ -> ] macOS [ ] Linux [ ] Windows

macOS version

$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.13.2
BuildVersion:   17C88

vim version

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan  5 2018 05:32:36)
macOS version
Included patches: 1-1428
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L.             -L /BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib -L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.3.0 -lobjc  

mono version

$ mono --version
Mono JIT compiler version 5.4.1.6 (tarball Mon Dec 11 14:59:42 GMT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)

Stacktrace

Welcome to the Mono soft debugger (sdb 1.5.6548.37600)
Type 'help' for a list of commands or 'quit' to exit

(sdb) Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Mono.Debugger.Client.LibEdit.ReadLine (string) [0x00013] in <1cbda40764ea421d9f191fd773578
e5a>:0
  at Mono.Debugger.Client.CommandLine.Run (System.Version,bool,bool,System.Collections.Generic.IEnumerable`1<string>,System
.Collections.Generic.IEnumerable`1<string>) [0x001a7] in <1cbda40764ea421d9f191fd773578e5a>:0
  at Mono.Debugger.Client.Program.Main (string[]) [0x00173] in <1cbda40764ea421d9f191fd773578e5a>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <1cbda40764ea42
1d9f191fd773578e5a>:0

Native stacktrace:

        0   mono                                0x00000001092e705e mono_handle_native_crash + 242
        1   mono                                0x000000010934619b altstack_handle_and_restore + 70
        2   ???                                 0xffffffffffffffff 0x0 + 18446744073709551615
        3   ???                                 0x00007faf354123b0 0x0 + 140390489465776
        4   libedit.3.dylib                     0x00007fff54dceb9e el_wgetc + 105
        5   libedit.3.dylib                     0x00007fff54dced53 el_wgets + 108
        6   libedit.3.dylib                     0x00007fff54dda995 el_gets + 37
        7   libedit.3.dylib                     0x00007fff54dcf7dd readline + 231
        8   ???                                 0x000000010e6d43d9 0x0 + 4537009113
        9   ???                                 0x0000000109729633 0x0 + 4453471795
        10  ???                                 0x000000010972984d 0x0 + 4453472333
        11  mono                                0x000000010925c183 mono_jit_runtime_invoke + 1264
        12  mono                                0x000000010940bb79 do_runtime_invoke + 88
        13  mono                                0x000000010940e815 do_exec_main_checked + 90
        14  mono                                0x00000001092b52a6 mono_jit_exec + 305
        15  mono                                0x00000001092b7638 mono_main + 8077
        16  mono                                0x000000010924e855 main + 245
        17  libdyld.dylib                       0x00007fff563e7115 start + 1
        18  ???                                 0x0000000000000003 0x0 + 3

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.vV7Gwz'
Executing commands in '/tmp/mono-gdb-commands.vV7Gwz'.
(lldb) process attach --pid 1594
Process 1594 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff56537502 <+10>: jae    0x7fff5653750c            ; <+20>
    0x7fff56537504 <+12>: movq   %rax, %rdi
    0x7fff56537507 <+15>: jmp    0x7fff5652e0dd            ; cerror
    0x7fff5653750c <+20>: retq   
Target 0: (mono) stopped.

Executable module set to "/usr/local/bin/mono".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 1594 stopped
* thread #1: tid = 0xcc24, 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.mai
n-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0xcc29, 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0xcc2a, 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0xcc2b, 0x00007fff5652d7fe libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0xcc2c, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0xcc2d, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0xcc30, 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #8: tid = 0xcc31, 0x0000000000000000
  thread #9: tid = 0xcc39, 0x00007fff56538372 libsystem_kernel.dylib`poll + 10, name = 'tid_1a07'
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff56537502 libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x00000001092e70eb mono`mono_handle_native_crash + 383
    frame #2: 0x000000010934619b mono`altstack_handle_and_restore + 70
  frame #3: 0xffffffffffffffff 
  thread #2, name = 'SGen worker'
    frame #0: 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff56673662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010946f07f mono`thread_func + 628
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'SGen worker'
    frame #0: 0x00007fff56536cee libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff56673662 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #2: 0x000000010946f062 mono`thread_func + 599
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #4, name = 'Finalizer'
    frame #0: 0x00007fff5652d7fe libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0000000109404aa6 mono`finalizer_thread + 293
    frame #2: 0x00000001093dfdc8 mono`start_wrapper + 605
    frame #3: 0x00007fff566726c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #4: 0x00007fff5667256d libsystem_pthread.dylib`_pthread_start + 377
    frame #5: 0x00007fff56671c5d libsystem_pthread.dylib`thread_start + 13
  thread #5
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667206a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #6
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667206a libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #7
    frame #0: 0x00007fff56537562 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff5667226f libsystem_pthread.dylib`_pthread_wqthread + 1552
    frame #2: 0x00007fff56671c4d libsystem_pthread.dylib`start_wqthread + 13
  thread #8
    frame #0: 0x0000000000000000
  thread #9, name = 'tid_1a07'
    frame #0: 0x00007fff56538372 libsystem_kernel.dylib`poll + 10
    frame #1: 0x000000010e5e5758 libMonoPosixHelper.dylib`Mono_Unix_UnixSignal_WaitAny + 612
    frame #2: 0x000000010e6d19af
(lldb) detach

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

(lldb) quit
Process 1594 detached
alexrp commented 6 years ago

I recall having run into this issue in the past. I tend to think it's actually a libedit bug. I don't know if OS X has libreadline available, but if it does, I would recommend remapping the libedit reference in sdb.exe.config to libreadline.dylib, as libreadline is generally more stable, less buggy, and has more features.

callmekohei commented 6 years ago

Hello! I'm callmekohei!

So, you are right!

sdb/mono just work well.

Thank you!

I do following:

/// change libedit ---> libreadline
<configuration>
    <dllmap dll="libedit" target="libedit.so.2" os="!windows" />
    <dllmap dll="libedit" target="/usr/local/Cellar/readline/7.0.3_1/lib/libreadline.7.0.dylib" os="osx" />
</configuration>

pic

untitled