Loading ...
Sorry, an error occurred while loading the content.

Re: Debugging vim crash on windows

Expand Messages
  • Christian Brabandt
    Hi char101! ... My guess is, that the alloc failed and returned NULL. Perhaps this patch helps to avoid it: diff --git a/src/eval.c b/src/eval.c ... +++
    Message 1 of 6 , Jun 2, 2012
    • 0 Attachment
      Hi char101!

      On Sa, 02 Jun 2012, char101 wrote:

      > Hi,
      >
      > Lately I have been getting rather frequent crash with gvim. It seems to happen randomly. I do have a debug info of the crash. Unfortunately I cannot find what is causing the crash by looking at the debug info. Can anyone help me finding the problem that made gvim crash?
      >
      > Crash info:
      >
      > (c70.1018): Access violation - code c0000005 (!!! second chance !!!)
      > eax=01cfb950 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=0012e418
      > eip=00438bed esp=0012dab0 ebp=0012df24 iopl=0 nv up ei pl nz na pe nc
      > cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
      > gvim!call_user_func+0x8d:
      > 00438bed 8903 mov dword ptr [ebx],eax ds:0023:00000000=????????
      > 0:000> ub
      > gvim!call_user_func+0x6c [eval.c @ 22225]:
      > 00438bcc 6808060000 push 608h
      > 00438bd1 e87a7d0600 call gvim!lalloc (004a0950)
      > 00438bd6 8b0d08db5500 mov ecx,dword ptr [gvim!current_funccal (0055db08)]
      > 00438bdc 8b1508df5500 mov edx,dword ptr [gvim!ex_nesting_level (0055df08)]
      > 00438be2 8bd8 mov ebx,eax
      > 00438be4 8b4508 mov eax,dword ptr [ebp+8]
      > 00438be7 56 push esi
      > 00438be8 68fc4b5500 push offset gvim!dbg_breakp (00554bfc)
      >
      > It seems that since ebx is 0, vim is trying to access zero pointer. But I cannot find which pointer is it.
      >
      > Source code where the crash happen
      >
      > fc = (funccall_T *)alloc(sizeof(funccall_T));
      > fc->caller = current_funccal;
      > current_funccal = fc;
      > fc->func = fp;
      > fc->rettv = rettv;
      > rettv->vval.v_number = 0;
      > fc->linenr = 0;
      > fc->returned = FALSE;
      > fc->level = ex_nesting_level;
      > /* Check if this function has a breakpoint. */
      > fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); <--- crash here
      > fc->dbg_tick = debug_tick;

      My guess is, that the alloc failed and returned NULL.

      Perhaps this patch helps to avoid it:

      diff --git a/src/eval.c b/src/eval.c
      --- a/src/eval.c
      +++ b/src/eval.c
      @@ -22227,6 +22227,13 @@
      line_breakcheck(); /* check for CTRL-C hit */

      fc = (funccall_T *)alloc(sizeof(funccall_T));
      + if (fc == NULL)
      + {
      + do_outofmem_msg((long_u) sizeof(funccall_T));
      + rettv->v_type = VAR_NUMBER;
      + rettv->vval.v_number = -1;
      + return;
      + }
      fc->caller = current_funccal;
      current_funccal = fc;
      fc->func = fp;


      regards,
      Christian
      --
      Evolution ist die Entwicklung vom Tümpel in den Fernsehsessel.
      -- Erwin Pelzig

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Dominique Pellé
      ... Which version of Vim are you using? (output of :version) Several patches since official version 7.3 fix crashes. Latest version is Vim-7.3.538. Regards --
      Message 2 of 6 , Jun 2, 2012
      • 0 Attachment
        char101 <peacech@...> wrote:

        > Hi,
        >
        > Lately I have been getting rather frequent crash with gvim. It seems to happen randomly. I do have a debug info of the crash. Unfortunately I cannot find what is causing the crash by looking at the debug info. Can anyone help me finding the problem that made gvim crash?
        >
        > Crash info:
        >
        > (c70.1018): Access violation - code c0000005 (!!! second chance !!!)
        > eax=01cfb950 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=0012e418
        > eip=00438bed esp=0012dab0 ebp=0012df24 iopl=0         nv up ei pl nz na pe nc
        > cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
        > gvim!call_user_func+0x8d:
        > 00438bed 8903            mov     dword ptr [ebx],eax  ds:0023:00000000=????????
        > 0:000> ub
        > gvim!call_user_func+0x6c [eval.c @ 22225]:
        > 00438bcc 6808060000      push    608h
        > 00438bd1 e87a7d0600      call    gvim!lalloc (004a0950)
        > 00438bd6 8b0d08db5500    mov     ecx,dword ptr [gvim!current_funccal (0055db08)]
        > 00438bdc 8b1508df5500    mov     edx,dword ptr [gvim!ex_nesting_level (0055df08)]
        > 00438be2 8bd8            mov     ebx,eax
        > 00438be4 8b4508          mov     eax,dword ptr [ebp+8]
        > 00438be7 56              push    esi
        > 00438be8 68fc4b5500      push    offset gvim!dbg_breakp (00554bfc)
        >
        > It seems that since ebx is 0, vim is trying to access zero pointer. But I cannot find which pointer is it.
        >
        > Source code where the crash happen
        >
        >    fc = (funccall_T *)alloc(sizeof(funccall_T));
        >    fc->caller = current_funccal;
        >    current_funccal = fc;
        >    fc->func = fp;
        >    fc->rettv = rettv;
        >    rettv->vval.v_number = 0;
        >    fc->linenr = 0;
        >    fc->returned = FALSE;
        >    fc->level = ex_nesting_level;
        >    /* Check if this function has a breakpoint. */
        >    fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); <--- crash here
        >    fc->dbg_tick = debug_tick;


        Which version of Vim are you using? (output of :version)

        Several patches since official version 7.3 fix crashes.
        Latest version is Vim-7.3.538.

        Regards
        -- Dominique

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • char101
        ... Thank you for the patch Christian. I will try to apply it and see if any memory allocation error message pop up. If the alloc failed, then there could be
        Message 3 of 6 , Jun 2, 2012
        • 0 Attachment
          On Saturday, June 2, 2012 6:57:15 PM UTC+7, Christian Brabandt wrote:
          > My guess is, that the alloc failed and returned NULL.
          >
          > Perhaps this patch helps to avoid it:
          >
          > diff --git a/src/eval.c b/src/eval.c
          > --- a/src/eval.c
          > +++ b/src/eval.c
          > @@ -22227,6 +22227,13 @@
          > line_breakcheck(); /* check for CTRL-C hit */
          >
          > fc = (funccall_T *)alloc(sizeof(funccall_T));
          > + if (fc == NULL)
          > + {
          > + do_outofmem_msg((long_u) sizeof(funccall_T));
          > + rettv->v_type = VAR_NUMBER;
          > + rettv->vval.v_number = -1;
          > + return;
          > + }
          > fc->caller = current_funccal;
          > current_funccal = fc;
          > fc->func = fp;

          Thank you for the patch Christian. I will try to apply it and see if any memory allocation error message pop up. If the alloc failed, then there could be something wrong with vim memory allocation since I still have 4 GB free memory.

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • char101
          ... Hi, I am using the latest version. But the random crash happens since several months ago. I don t remember exactly when since it happens randomly. I am
          Message 4 of 6 , Jun 2, 2012
          • 0 Attachment
            On Saturday, June 2, 2012 7:15:11 PM UTC+7, Dominique Pelle wrote:
            > char101
            > wrote:
            >
            > > Hi,
            > >
            > > Lately I have been getting rather frequent crash with gvim. It seems to happen randomly. I do have a debug info of the crash. Unfortunately I cannot find what is causing the crash by looking at the debug info. Can anyone help me finding the problem that made gvim crash?
            > >
            > > Crash info:
            > >
            > > (c70.1018): Access violation - code c0000005 (!!! second chance !!!)
            > > eax=01cfb950 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=0012e418
            > > eip=00438bed esp=0012dab0 ebp=0012df24 iopl=0         nv up ei pl nz na pe nc
            > > cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
            > > gvim!call_user_func+0x8d:
            > > 00438bed 8903            mov     dword ptr [ebx],eax  ds:0023:00000000=????????
            > > 0:000> ub
            > > gvim!call_user_func+0x6c [eval.c @ 22225]:
            > > 00438bcc 6808060000      push    608h
            > > 00438bd1 e87a7d0600      call    gvim!lalloc (004a0950)
            > > 00438bd6 8b0d08db5500    mov     ecx,dword ptr [gvim!current_funccal (0055db08)]
            > > 00438bdc 8b1508df5500    mov     edx,dword ptr [gvim!ex_nesting_level (0055df08)]
            > > 00438be2 8bd8            mov     ebx,eax
            > > 00438be4 8b4508          mov     eax,dword ptr [ebp+8]
            > > 00438be7 56              push    esi
            > > 00438be8 68fc4b5500      push    offset gvim!dbg_breakp (00554bfc)
            > >
            > > It seems that since ebx is 0, vim is trying to access zero pointer. But I cannot find which pointer is it.
            > >
            > > Source code where the crash happen
            > >
            > >    fc = (funccall_T *)alloc(sizeof(funccall_T));
            > >    fc->caller = current_funccal;
            > >    current_funccal = fc;
            > >    fc->func = fp;
            > >    fc->rettv = rettv;
            > >    rettv->vval.v_number = 0;
            > >    fc->linenr = 0;
            > >    fc->returned = FALSE;
            > >    fc->level = ex_nesting_level;
            > >    /* Check if this function has a breakpoint. */
            > >    fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0); <--- crash here
            > >    fc->dbg_tick = debug_tick;
            >
            >
            > Which version of Vim are you using? (output of :version)
            >
            > Several patches since official version 7.3 fix crashes.
            > Latest version is Vim-7.3.538.

            Hi,

            I am using the latest version. But the random crash happens since several months ago. I don't remember exactly when since it happens randomly. I am also getting memory allocation fail randomly too. I does not happens frequently, maybe once a week.

            This is the outout of version

            VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 2 2012 13:20:10)
            MS-Windows 32-bit GUI version
            Included patches: 1-538
            Compiled by Charles@SOLARIS
            Normal version with GUI. Features included (+) or not (-):
            -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist
            +cmdline_info +comments +conceal -cryptv -cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic
            -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +float +folding -footer -gettext -hangul_input
            -iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +lua +menu +mksession
            +modify_fname +mouse +mouseshape +multi_byte -multi_lang -mzscheme -netbeans_intg -ole +path_extra -perl -persistent_undo
            -printer -profile +python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime
            +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl -tgetent -termresponse +textobjects +title
            +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows
            +writebackup -xfontset -xim -xterm_save -xpm_w32
            system vimrc file: "$VIM\vimrc"
            user vimrc file: "$HOME\_vimrc"
            2nd user vimrc file: "$VIM\_vimrc"
            user exrc file: "$HOME\_exrc"
            2nd user exrc file: "$VIM\_exrc"
            system gvimrc file: "$VIM\gvimrc"
            user gvimrc file: "$HOME\_gvimrc"
            2nd user gvimrc file: "$VIM\_gvimrc"
            system menu file: "$VIMRUNTIME\menu.vim"
            Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_AUTOCHDIR -DFEAT_SIGNS -DFEAT_CONCEAL -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /Fo.\ObjGUY/ /O2 /GS- /fp:fast /GL -DNDEBUG /arch:SSE2 /MD -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_LUA -DFEAT_PYTHON -DFEAT_NORMAL /Fd.\ObjGUY/ /Zi
            Linking: link /RELEASE /nologo /subsystem:windows /OPT:REF /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib msvcrt.lib user32.lib uxtheme.lib comctl32.lib pnglib.lib "P:\@editor\vim\app\lua\lib\lua51.lib" P:\@editor\vim\app\python\libs\python27.lib /PDB:gvim.pdb -debug

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • char101
            ... [DELETE] Could this be the cause Quote from http://msdn.microsoft.com/en-us/library/windows/desktop/aa366586%28v=vs.85%29.aspx ... On computers with more
            Message 5 of 6 , Jun 2, 2012
            • 0 Attachment
              On Saturday, June 2, 2012 3:55:32 PM UTC+7, char101 wrote:
              > Hi,
              >
              > Lately I have been getting rather frequent crash with gvim. It seems to happen randomly. I do have a debug info of the crash. Unfortunately I cannot find what is causing the crash by looking at the debug info. Can anyone help me finding the problem that made gvim crash?
              [DELETE]

              Could this be the cause

              Quote from http://msdn.microsoft.com/en-us/library/windows/desktop/aa366586%28v=vs.85%29.aspx

              ---
              On computers with more than 4 GB of memory, the GlobalMemoryStatus function can return incorrect information, reporting a value of –1 to indicate an overflow.
              ---

              Since vim alloc check for free memory using GlobalMemoryStatus and I have a 8 GB memory, it is possible that the function returns incorrect value. I will try to use GlobalMemoryStatusEx and see if any crash happen.

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            Your message has been successfully submitted and would be delivered to recipients shortly.