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

vim 7.2 compiles fine on MSYS but it doesn't execute

Expand Messages
  • Cesar Romani
    I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine. ... $ vim Vim: Caught deadly signal SEGV Vim: Finished. ... $ gdb vim.exe GNU gdb 6.8
    Message 1 of 15 , Jun 5, 2009
    • 0 Attachment
      I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine.
      However, when I execute it, I get:
      --------------------
      $ vim
      Vim: Caught deadly signal SEGV
      Vim: Finished.
      --------------------

      If I run gdb on it, I get:
      --------------------
      $ gdb vim.exe
      GNU gdb 6.8
      Copyright (C) 2008 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later
      <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law. Type "show copying"
      and "show warranty" for details.
      This GDB was configured as "i686-pc-mingw32"...
      (gdb) run
      Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
      [New thread 5908.0xfec]
      Vim: Warning: Output is not to a terminal
      Vim: Warning: Input is not from a terminal
      [New thread 5908.0x580]

      Program received signal SIGSEGV, Segmentation fault.
      0x004fee32 in set_termname (
      term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
      1866 if (STRCMP(term, "pcterm") == 0)
      --------------------

      The compilation and execution of vim for win32 with MingW is fine and I
      want to compile it on the MSYS environment because the vim version there
      is too old, 5.8

      Many thanks in advance,
      Cesar


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... Strange that it crashes there. Earlier in the set_termname() function there is this line: if (term_is_builtin(term)) Try setting a breakpoint there. With
      Message 2 of 15 , Jun 6, 2009
      • 0 Attachment
        Cesar Romani wrote:

        > I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine.
        > However, when I execute it, I get:
        > --------------------
        > $ vim
        > Vim: Caught deadly signal SEGV
        > Vim: Finished.
        > --------------------
        >
        > If I run gdb on it, I get:
        > --------------------
        > $ gdb vim.exe
        > GNU gdb 6.8
        > Copyright (C) 2008 Free Software Foundation, Inc.
        > License GPLv3+: GNU GPL version 3 or later
        > <http://gnu.org/licenses/gpl.html>
        > This is free software: you are free to change and redistribute it.
        > There is NO WARRANTY, to the extent permitted by law. Type "show copying"
        > and "show warranty" for details.
        > This GDB was configured as "i686-pc-mingw32"...
        > (gdb) run
        > Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
        > [New thread 5908.0xfec]
        > Vim: Warning: Output is not to a terminal
        > Vim: Warning: Input is not from a terminal
        > [New thread 5908.0x580]
        >
        > Program received signal SIGSEGV, Segmentation fault.
        > 0x004fee32 in set_termname (
        > term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
        > 1866 if (STRCMP(term, "pcterm") == 0)
        > --------------------
        >
        > The compilation and execution of vim for win32 with MingW is fine and I
        > want to compile it on the MSYS environment because the vim version there
        > is too old, 5.8

        Strange that it crashes there. Earlier in the set_termname() function
        there is this line:

        if (term_is_builtin(term))

        Try setting a breakpoint there.

        With weird errors I suspect the compiler. Did you disable the
        optimizer? There are quite a few versions of gcc with bugs in the
        optimizer code.

        --
        A)bort, R)etry, B)ang it with a large hammer

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Cesar Romani
        ... copying ... The gcc version I m using is 2.95.3-1 and the optimizer isn t disabled: CFLAGS = -g -O2 If I put a break at line 1615: if
        Message 3 of 15 , Jun 6, 2009
        • 0 Attachment
          Bram Moolenaar wrote:
          >
          > Cesar Romani wrote:
          >
          >> I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine.
          >> However, when I execute it, I get:
          >> --------------------
          >> $ vim
          >> Vim: Caught deadly signal SEGV
          >> Vim: Finished.
          >> --------------------
          >>
          >> If I run gdb on it, I get:
          >> --------------------
          >> $ gdb vim.exe
          >> GNU gdb 6.8
          >> Copyright (C) 2008 Free Software Foundation, Inc.
          >> License GPLv3+: GNU GPL version 3 or later
          >> <http://gnu.org/licenses/gpl.html>
          >> This is free software: you are free to change and redistribute it.
          >> There is NO WARRANTY, to the extent permitted by law. Type "show
          copying"
          >> and "show warranty" for details.
          >> This GDB was configured as "i686-pc-mingw32"...
          >> (gdb) run
          >> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
          >> [New thread 5908.0xfec]
          >> Vim: Warning: Output is not to a terminal
          >> Vim: Warning: Input is not from a terminal
          >> [New thread 5908.0x580]
          >>
          >> Program received signal SIGSEGV, Segmentation fault.
          >> 0x004fee32 in set_termname (
          >> term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
          >> 1866 if (STRCMP(term, "pcterm") == 0)
          >> --------------------
          >>
          >> The compilation and execution of vim for win32 with MingW is fine and I
          >> want to compile it on the MSYS environment because the vim version there
          >> is too old, 5.8
          >
          > Strange that it crashes there. Earlier in the set_termname() function
          > there is this line:
          >
          > if (term_is_builtin(term))
          >
          > Try setting a breakpoint there.
          >
          > With weird errors I suspect the compiler. Did you disable the
          > optimizer? There are quite a few versions of gcc with bugs in the
          > optimizer code.

          The gcc version I'm using is 2.95.3-1
          and the optimizer isn't disabled:
          CFLAGS = -g -O2

          If I put a break at line 1615:
          if (term_is_builtin(term))
          I get:
          --------------------
          (gdb) break term.c:1615
          Breakpoint 1 at 0x4fcdee: file term.c, line 1615.
          (gdb) run
          The program being debugged has been started already.
          Start it from the beginning? (y or n) [answered Y; input not from
          terminal]
          Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
          [New thread 3524.0x7b8]
          Vim: Warning: Output is not to a terminal
          Vim: Warning: Input is not from a terminal
          [New thread 3524.0x59c]

          Breakpoint 1, set_termname (term=0xa0158b8 "msys") at term.c:1615
          1615 if (term_is_builtin(term))
          --------------------

          Regards,
          Cesar


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Dominique Pellé
          ... I don t understand how term can be correct at line term.c:1615 and then later incorrect at line 1866. It s worth disabling optimization by building Vim
          Message 4 of 15 , Jun 6, 2009
          • 0 Attachment
            Cesar Romani wrote:

            > Bram Moolenaar wrote:
            >>
            >> Cesar Romani wrote:
            >>
            >>> I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine.
            >>> However, when I execute it, I get:
            >>> --------------------
            >>> $ vim
            >>> Vim: Caught deadly signal SEGV
            >>> Vim: Finished.
            >>> --------------------
            >>>
            >>> If I run gdb on it, I get:
            >>> --------------------
            >>> $ gdb vim.exe
            >>> GNU gdb 6.8
            >>> Copyright (C) 2008 Free Software Foundation, Inc.
            >>> License GPLv3+: GNU GPL version 3 or later
            >>> <http://gnu.org/licenses/gpl.html>
            >>> This is free software: you are free to change and redistribute it.
            >>> There is NO WARRANTY, to the extent permitted by law.  Type "show
            > copying"
            >>> and "show warranty" for details.
            >>> This GDB was configured as "i686-pc-mingw32"...
            >>> (gdb) run
            >>> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
            >>> [New thread 5908.0xfec]
            >>> Vim: Warning: Output is not to a terminal
            >>> Vim: Warning: Input is not from a terminal
            >>> [New thread 5908.0x580]
            >>>
            >>> Program received signal SIGSEGV, Segmentation fault.
            >>> 0x004fee32 in set_termname (
            >>>     term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
            >>> 1866        if (STRCMP(term, "pcterm") == 0)
            >>> --------------------
            >>>
            >>> The compilation and execution of vim for win32 with MingW is fine and I
            >>> want to compile it on the MSYS environment because the vim version there
            >>> is too old, 5.8
            >>
            >> Strange that it crashes there.  Earlier in the set_termname() function
            >> there is this line:
            >>
            >>    if (term_is_builtin(term))
            >>
            >> Try setting a breakpoint there.
            >>
            >> With weird errors I suspect the compiler.  Did you disable the
            >> optimizer?  There are quite a few versions of gcc with bugs in the
            >> optimizer code.
            >
            > The gcc version I'm using is 2.95.3-1
            > and the optimizer isn't disabled:
            > CFLAGS = -g -O2
            >
            > If I put a break at line 1615:
            >    if (term_is_builtin(term))
            > I get:
            > --------------------
            > (gdb) break term.c:1615
            > Breakpoint 1 at 0x4fcdee: file term.c, line 1615.
            > (gdb) run
            > The program being debugged has been started already.
            > Start it from the beginning? (y or n) [answered Y; input not from
            > terminal]
            > Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
            > [New thread 3524.0x7b8]
            > Vim: Warning: Output is not to a terminal
            > Vim: Warning: Input is not from a terminal
            > [New thread 3524.0x59c]
            >
            > Breakpoint 1, set_termname (term=0xa0158b8 "msys") at term.c:1615
            > 1615        if (term_is_builtin(term))
            > --------------------
            >
            > Regards,
            > Cesar


            I don't understand how term can be correct at line term.c:1615 and
            then later incorrect at line 1866.

            It's worth disabling optimization by building Vim with -O0 instead of -O2.
            This can be done by adding a line in src/Makefile with -O0. For example:

            528 # Often used for GCC: mixed optimizing, lot of optimizing, debugging
            529 CFLAGS = -g -O0 -Wall

            Then re-compile with: "make clean; make"

            When putting a breakpoint at line term.c:1615,
            what is the value of 'term' variable? (output of gdb command: print term)

            Ex:

            (gdb) p term
            $1 = (char_u *) 0x946e25c "xterm-256color"

            What is also the value of 'term' later at line 1866 where it crashes?

            Output of gdb command "bt full" might also be helpful.

            Cheers
            -- Dominique

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Cesar Romani
            ... there ... $1 = (char_u *) 0xa0158c0 msys ... $1 = (char_u *) 0x3a6c3532 ... (gdb) bt full #0 0x004fd3a2 in
            Message 5 of 15 , Jun 6, 2009
            • 0 Attachment
              Dominique Pellé wrote:
              > Cesar Romani wrote:
              >
              >> Bram Moolenaar wrote:
              >>> Cesar Romani wrote:
              >>>
              >>>> I tried compiling vim 7.2 with termcap on MSYS, and it compiles fine.
              >>>> However, when I execute it, I get:
              >>>> --------------------
              >>>> $ vim
              >>>> Vim: Caught deadly signal SEGV
              >>>> Vim: Finished.
              >>>> --------------------
              >>>>
              >>>> If I run gdb on it, I get:
              >>>> --------------------
              >>>> $ gdb vim.exe
              >>>> GNU gdb 6.8
              >>>> Copyright (C) 2008 Free Software Foundation, Inc.
              >>>> License GPLv3+: GNU GPL version 3 or later
              >>>> <http://gnu.org/licenses/gpl.html>
              >>>> This is free software: you are free to change and redistribute it.
              >>>> There is NO WARRANTY, to the extent permitted by law. Type "show
              >> copying"
              >>>> and "show warranty" for details.
              >>>> This GDB was configured as "i686-pc-mingw32"...
              >>>> (gdb) run
              >>>> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
              >>>> [New thread 5908.0xfec]
              >>>> Vim: Warning: Output is not to a terminal
              >>>> Vim: Warning: Input is not from a terminal
              >>>> [New thread 5908.0x580]
              >>>>
              >>>> Program received signal SIGSEGV, Segmentation fault.
              >>>> 0x004fee32 in set_termname (
              >>>> term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
              >>>> 1866 if (STRCMP(term, "pcterm") == 0)
              >>>> --------------------
              >>>>
              >>>> The compilation and execution of vim for win32 with MingW is fine and I
              >>>> want to compile it on the MSYS environment because the vim version
              there
              >>>> is too old, 5.8
              >>> Strange that it crashes there. Earlier in the set_termname() function
              >>> there is this line:
              >>>
              >>> if (term_is_builtin(term))
              >>>
              >>> Try setting a breakpoint there.
              >>>
              >>> With weird errors I suspect the compiler. Did you disable the
              >>> optimizer? There are quite a few versions of gcc with bugs in the
              >>> optimizer code.
              >> The gcc version I'm using is 2.95.3-1
              >> and the optimizer isn't disabled:
              >> CFLAGS = -g -O2
              >>
              >> If I put a break at line 1615:
              >> if (term_is_builtin(term))
              >> I get:
              >> --------------------
              >> (gdb) break term.c:1615
              >> Breakpoint 1 at 0x4fcdee: file term.c, line 1615.
              >> (gdb) run
              >> The program being debugged has been started already.
              >> Start it from the beginning? (y or n) [answered Y; input not from
              >> terminal]
              >> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
              >> [New thread 3524.0x7b8]
              >> Vim: Warning: Output is not to a terminal
              >> Vim: Warning: Input is not from a terminal
              >> [New thread 3524.0x59c]
              >>
              >> Breakpoint 1, set_termname (term=0xa0158b8 "msys") at term.c:1615
              >> 1615 if (term_is_builtin(term))
              >> --------------------
              >>
              >> Regards,
              >> Cesar
              >
              >
              > I don't understand how term can be correct at line term.c:1615 and
              > then later incorrect at line 1866.
              >
              > It's worth disabling optimization by building Vim with -O0 instead of -O2.
              > This can be done by adding a line in src/Makefile with -O0. For example:
              >
              > 528 # Often used for GCC: mixed optimizing, lot of optimizing, debugging
              > 529 CFLAGS = -g -O0 -Wall
              >
              > Then re-compile with: "make clean; make"
              >
              > When putting a breakpoint at line term.c:1615,
              > what is the value of 'term' variable? (output of gdb command: print term)
              >
              > Ex:
              >
              > (gdb) p term
              > $1 = (char_u *) 0x946e25c "xterm-256color"

              $1 = (char_u *) 0xa0158c0 "msys"

              > What is also the value of 'term' later at line 1866 where it crashes?

              $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>

              > Output of gdb command "bt full" might also be helpful.

              --------------------
              (gdb) bt full
              #0 0x004fd3a2 in set_termname (
              term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
              termp = (struct builtin_term *) 0x22f860
              builtin_first = 1
              try = 2
              termcap_cleared = 1
              width = 80
              height = 25
              error_msg = (char_u *) 0x0
              bs_p = (char_u *) 0x22f860 ":\017R"
              del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
              #1 0x3f5b455c in ?? ()
              No symbol table info available.
              #2 0x3a6c3532 in ?? ()
              No symbol table info available.
              ...
              #189 0x00000000 in ?? ()
              No symbol table info available.
              --------------------

              If I re-compile with CFLAGS = -g -O0 -Wall, vim executes fine on the
              console but not on rxvt:

              --------------------
              (gdb) run
              Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
              [New thread 252.0xe14]
              Vim: Warning: Output is not to a terminal
              Vim: Warning: Input is not from a terminal
              [New thread 252.0xe3c]

              Program received signal SIGSEGV, Segmentation fault.
              0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
              --------------------

              For the console TERM=cygwin and for rxvt TERM=msys

              Regards,
              Cesar


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Dominique Pellé
              ... I can t see any place where term variable would be changed other than when it s set to DEFAULT_TERM at line 1816 (but that would not cause term pointer
              Message 6 of 15 , Jun 7, 2009
              • 0 Attachment
                Cesar Romani wrote:

                > Dominique Pellé wrote:
                ...
                >> When putting a breakpoint at line term.c:1615,
                >> what is the value of 'term' variable? (output of gdb command: print term)
                >>
                >> Ex:
                >>
                >> (gdb) p term
                >> $1 = (char_u *) 0x946e25c "xterm-256color"
                >
                > $1 = (char_u *) 0xa0158c0 "msys"
                >
                >> What is also the value of 'term' later at line 1866 where it crashes?
                >
                > $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                >
                >> Output of gdb command "bt full" might also be helpful.
                >
                > --------------------
                > (gdb) bt full
                > #0  0x004fd3a2 in set_termname (
                >    term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
                >        termp = (struct builtin_term *) 0x22f860
                >        builtin_first = 1
                >        try = 2
                >        termcap_cleared = 1
                >        width = 80
                >        height = 25
                >        error_msg = (char_u *) 0x0
                >        bs_p = (char_u *) 0x22f860 ":\017R"
                >        del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                > #1  0x3f5b455c in ?? ()
                > No symbol table info available.
                > #2  0x3a6c3532 in ?? ()
                > No symbol table info available.
                > ...
                > #189 0x00000000 in ?? ()
                > No symbol table info available.
                > --------------------

                I can't see any place where 'term' variable would be changed
                other than when it's set to DEFAULT_TERM at line 1816 (but
                that would not cause 'term' pointer to be incorrect).

                So it leaves the possibility of a corrupted stack.

                Can you put intermediate breakpoints (or execute line by line with
                the "next" gdb command if you prefer) between line term.c:1615
                (where 'term' pointer is still OK) and line term.c:1866 where 'term'
                pointer becomes invalid so we can narrow it down? At each steps,
                you can do "print term" in gdb to see when 'term' pointer starts to
                become "out of bounds".



                > If I re-compile with CFLAGS = -g -O0 -Wall, vim executes fine on the
                > console but not on rxvt:
                >
                > --------------------
                > (gdb) run
                > Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
                > [New thread 252.0xe14]
                > Vim: Warning: Output is not to a terminal
                > Vim: Warning: Input is not from a terminal
                > [New thread 252.0xe3c]
                >
                > Program received signal SIGSEGV, Segmentation fault.
                > 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
                > --------------------
                >
                > For the console TERM=cygwin and for rxvt TERM=msys

                Ah. So if I understand correctly what you're saying:
                - with -O0, Vim works in the cygwin console, but with -O2 it
                did not work in the cygwin console (correct?)
                - In in rxvt, it still does not work even with -O0. What is the
                stack where it crashes? (output of gdb "backtrace" command).

                Thanks
                -- Dominique

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Cesar Romani
                ... term) ... Breakpoint 1, set_termname (term=0xa0158c0 msys ) at term.c:1615 1615 if (term_is_builtin(term)) (gdb) p term $1 = (char_u *) 0xa0158c0
                Message 7 of 15 , Jun 7, 2009
                • 0 Attachment
                  Dominique Pellé wrote:
                  > Cesar Romani wrote:
                  >
                  >> Dominique Pellé wrote:
                  > ...
                  >>> When putting a breakpoint at line term.c:1615,
                  >>> what is the value of 'term' variable? (output of gdb command: print
                  term)
                  >>>
                  >>> Ex:
                  >>>
                  >>> (gdb) p term
                  >>> $1 = (char_u *) 0x946e25c "xterm-256color"
                  >> $1 = (char_u *) 0xa0158c0 "msys"
                  >>
                  >>> What is also the value of 'term' later at line 1866 where it crashes?
                  >> $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                  >>
                  >>> Output of gdb command "bt full" might also be helpful.
                  >> --------------------
                  >> (gdb) bt full
                  >> #0 0x004fd3a2 in set_termname (
                  >> term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
                  >> termp = (struct builtin_term *) 0x22f860
                  >> builtin_first = 1
                  >> try = 2
                  >> termcap_cleared = 1
                  >> width = 80
                  >> height = 25
                  >> error_msg = (char_u *) 0x0
                  >> bs_p = (char_u *) 0x22f860 ":\017R"
                  >> del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                  >> #1 0x3f5b455c in ?? ()
                  >> No symbol table info available.
                  >> #2 0x3a6c3532 in ?? ()
                  >> No symbol table info available.
                  >> ...
                  >> #189 0x00000000 in ?? ()
                  >> No symbol table info available.
                  >> --------------------
                  >
                  > I can't see any place where 'term' variable would be changed
                  > other than when it's set to DEFAULT_TERM at line 1816 (but
                  > that would not cause 'term' pointer to be incorrect).
                  >
                  > So it leaves the possibility of a corrupted stack.
                  >
                  > Can you put intermediate breakpoints (or execute line by line with
                  > the "next" gdb command if you prefer) between line term.c:1615
                  > (where 'term' pointer is still OK) and line term.c:1866 where 'term'
                  > pointer becomes invalid so we can narrow it down? At each steps,
                  > you can do "print term" in gdb to see when 'term' pointer starts to
                  > become "out of bounds".

                  --------------------
                  Breakpoint 1, set_termname (term=0xa0158c0 "msys") at term.c:1615
                  1615 if (term_is_builtin(term))
                  (gdb) p term
                  $1 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                  (gdb) p term
                  $2 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1639 if (try == 1)
                  (gdb) p term
                  $3 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1762 if (try == 2 && builtin_first && termcap_cleared)
                  (gdb) p term
                  $4 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1768 termp = find_builtin_term(term);
                  (gdb) p term
                  $5 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1769 if (termp->bt_string == NULL) /* did not find
                  it */
                  (gdb) p term
                  $6 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1779 if (try == 0) /* try external
                  one */
                  (gdb) p term
                  $7 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1780 continue;
                  (gdb) p term
                  $8 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                  (gdb) p term
                  $9 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1639 if (try == 1)
                  (gdb) p term
                  $10 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1675 if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                  (gdb) p term
                  $11 = (char_u *) 0xa0158c0 "msys"
                  (gdb) n
                  1677 tp = tstrbuf;
                  (gdb) p term
                  $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>
                  --------------------

                  >> If I re-compile with CFLAGS = -g -O0 -Wall, vim executes fine on the
                  >> console but not on rxvt:
                  >>
                  >> --------------------
                  >> (gdb) run
                  >> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
                  >> [New thread 252.0xe14]
                  >> Vim: Warning: Output is not to a terminal
                  >> Vim: Warning: Input is not from a terminal
                  >> [New thread 252.0xe3c]
                  >>
                  >> Program received signal SIGSEGV, Segmentation fault.
                  >> 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
                  >> --------------------
                  >>
                  >> For the console TERM=cygwin and for rxvt TERM=msys
                  >
                  > Ah. So if I understand correctly what you're saying:
                  > - with -O0, Vim works in the cygwin console, but with -O2 it
                  > did not work in the cygwin console (correct?)

                  that's correct.

                  > - In in rxvt, it still does not work even with -O0. What is the
                  > stack where it crashes? (output of gdb "backtrace" command).

                  --------------------
                  (gdb) backtrace
                  #0 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
                  #1 0x0053a9d4 in set_termname (
                  term=0x5b455c3d <Address 0x5b455c3d out of bounds>) at term.c:1866
                  #2 0x69253a24 in ?? ()
                  #3 0x5b455c3d in ?? ()
                  ...
                  #176 0x0022003a in ?? ()
                  #177 0x71004c7f in msys-1!_dll_crt0@0 () from C:\msys\1.0\bin\msys-1.0.dll
                  (gdb) Cannot access memory at address 0x355b4560
                  --------------------

                  Regards,
                  Cesar


                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Cesar Romani
                  ... term) ... crashes? ... bounds ... Breakpoint 1, set_termname (term=0xa0158c0 msys ) at term.c:1615 1615 if (term_is_builtin(term)) (gdb) p term $1
                  Message 8 of 15 , Jun 7, 2009
                  • 0 Attachment
                    Dominique Pellé wrote:
                    > > Cesar Romani wrote:
                    > >
                    >> >> Dominique Pellé wrote:
                    > > ...
                    >>> >>> When putting a breakpoint at line term.c:1615,
                    >>> >>> what is the value of 'term' variable? (output of gdb command: print
                    term)
                    >>> >>>
                    >>> >>> Ex:
                    >>> >>>
                    >>> >>> (gdb) p term
                    >>> >>> $1 = (char_u *) 0x946e25c "xterm-256color"
                    >> >> $1 = (char_u *) 0xa0158c0 "msys"
                    >> >>
                    >>> >>> What is also the value of 'term' later at line 1866 where it
                    crashes?
                    >> >> $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                    >> >>
                    >>> >>> Output of gdb command "bt full" might also be helpful.
                    >> >> --------------------
                    >> >> (gdb) bt full
                    >> >> #0 0x004fd3a2 in set_termname (
                    >> >> term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
                    >> >> termp = (struct builtin_term *) 0x22f860
                    >> >> builtin_first = 1
                    >> >> try = 2
                    >> >> termcap_cleared = 1
                    >> >> width = 80
                    >> >> height = 25
                    >> >> error_msg = (char_u *) 0x0
                    >> >> bs_p = (char_u *) 0x22f860 ":\017R"
                    >> >> del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of
                    bounds>
                    >> >> #1 0x3f5b455c in ?? ()
                    >> >> No symbol table info available.
                    >> >> #2 0x3a6c3532 in ?? ()
                    >> >> No symbol table info available.
                    >> >> ...
                    >> >> #189 0x00000000 in ?? ()
                    >> >> No symbol table info available.
                    >> >> --------------------
                    > >
                    > > I can't see any place where 'term' variable would be changed
                    > > other than when it's set to DEFAULT_TERM at line 1816 (but
                    > > that would not cause 'term' pointer to be incorrect).
                    > >
                    > > So it leaves the possibility of a corrupted stack.
                    > >
                    > > Can you put intermediate breakpoints (or execute line by line with
                    > > the "next" gdb command if you prefer) between line term.c:1615
                    > > (where 'term' pointer is still OK) and line term.c:1866 where 'term'
                    > > pointer becomes invalid so we can narrow it down? At each steps,
                    > > you can do "print term" in gdb to see when 'term' pointer starts to
                    > > become "out of bounds".

                    --------------------
                    Breakpoint 1, set_termname (term=0xa0158c0 "msys") at term.c:1615
                    1615 if (term_is_builtin(term))
                    (gdb) p term
                    $1 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                    (gdb) p term
                    $2 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1639 if (try == 1)
                    (gdb) p term
                    $3 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1762 if (try == 2 && builtin_first && termcap_cleared)
                    (gdb) p term
                    $4 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1768 termp = find_builtin_term(term);
                    (gdb) p term
                    $5 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1769 if (termp->bt_string == NULL) /* did not find
                    it */
                    (gdb) p term
                    $6 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1779 if (try == 0) /* try external
                    one */
                    (gdb) p term
                    $7 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1780 continue;
                    (gdb) p term
                    $8 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                    (gdb) p term
                    $9 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1639 if (try == 1)
                    (gdb) p term
                    $10 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1675 if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                    (gdb) p term
                    $11 = (char_u *) 0xa0158c0 "msys"
                    (gdb) n
                    1677 tp = tstrbuf;
                    (gdb) p term
                    $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>
                    --------------------

                    >> >> If I re-compile with CFLAGS = -g -O0 -Wall, vim executes fine on the
                    >> >> console but not on rxvt:
                    >> >>
                    >> >> --------------------
                    >> >> (gdb) run
                    >> >> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
                    >> >> [New thread 252.0xe14]
                    >> >> Vim: Warning: Output is not to a terminal
                    >> >> Vim: Warning: Input is not from a terminal
                    >> >> [New thread 252.0xe3c]
                    >> >>
                    >> >> Program received signal SIGSEGV, Segmentation fault.
                    >> >> 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
                    >> >> --------------------
                    >> >>
                    >> >> For the console TERM=cygwin and for rxvt TERM=msys
                    > >
                    > > Ah. So if I understand correctly what you're saying:
                    > > - with -O0, Vim works in the cygwin console, but with -O2 it
                    > > did not work in the cygwin console (correct?)

                    that's correct.

                    > > - In in rxvt, it still does not work even with -O0. What is the
                    > > stack where it crashes? (output of gdb "backtrace" command).

                    --------------------
                    (gdb) backtrace
                    #0 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
                    #1 0x0053a9d4 in set_termname (
                    term=0x5b455c3d <Address 0x5b455c3d out of bounds>) at term.c:1866
                    #2 0x69253a24 in ?? ()
                    #3 0x5b455c3d in ?? ()
                    ...
                    #176 0x0022003a in ?? ()
                    #177 0x71004c7f in msys-1!_dll_crt0@0 () from C:\msys\1.0\bin\msys-1.0.dll
                    (gdb) Cannot access memory at address 0x355b4560
                    --------------------

                    Regards,
                    Cesar


                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_dev" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Bram Moolenaar
                    ... So tgetent_error() overwrites term . Try increasing the value for TBUFSZ in vim.h. Check the documentation for tgetent() to find out what the value
                    Message 9 of 15 , Jun 7, 2009
                    • 0 Attachment
                      Cesar Romani wrote:

                      > >> Dominique Pellé wrote:
                      > > ...
                      > >>> When putting a breakpoint at line term.c:1615,
                      > >>> what is the value of 'term' variable? (output of gdb command: print
                      > term)
                      > >>>
                      > >>> Ex:
                      > >>>
                      > >>> (gdb) p term
                      > >>> $1 = (char_u *) 0x946e25c "xterm-256color"
                      > >> $1 = (char_u *) 0xa0158c0 "msys"
                      > >>
                      > >>> What is also the value of 'term' later at line 1866 where it crashes?
                      > >> $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                      > >>
                      > >>> Output of gdb command "bt full" might also be helpful.
                      > >> --------------------
                      > >> (gdb) bt full
                      > >> #0 0x004fd3a2 in set_termname (
                      > >> term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
                      > >> termp = (struct builtin_term *) 0x22f860
                      > >> builtin_first = 1
                      > >> try = 2
                      > >> termcap_cleared = 1
                      > >> width = 80
                      > >> height = 25
                      > >> error_msg = (char_u *) 0x0
                      > >> bs_p = (char_u *) 0x22f860 ":\017R"
                      > >> del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
                      > >> #1 0x3f5b455c in ?? ()
                      > >> No symbol table info available.
                      > >> #2 0x3a6c3532 in ?? ()
                      > >> No symbol table info available.
                      > >> ...
                      > >> #189 0x00000000 in ?? ()
                      > >> No symbol table info available.
                      > >> --------------------
                      > >
                      > > I can't see any place where 'term' variable would be changed
                      > > other than when it's set to DEFAULT_TERM at line 1816 (but
                      > > that would not cause 'term' pointer to be incorrect).
                      > >
                      > > So it leaves the possibility of a corrupted stack.
                      > >
                      > > Can you put intermediate breakpoints (or execute line by line with
                      > > the "next" gdb command if you prefer) between line term.c:1615
                      > > (where 'term' pointer is still OK) and line term.c:1866 where 'term'
                      > > pointer becomes invalid so we can narrow it down? At each steps,
                      > > you can do "print term" in gdb to see when 'term' pointer starts to
                      > > become "out of bounds".
                      >
                      > --------------------
                      > Breakpoint 1, set_termname (term=0xa0158c0 "msys") at term.c:1615
                      > 1615 if (term_is_builtin(term))
                      > (gdb) p term
                      > $1 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                      > (gdb) p term
                      > $2 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1639 if (try == 1)
                      > (gdb) p term
                      > $3 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1762 if (try == 2 && builtin_first && termcap_cleared)
                      > (gdb) p term
                      > $4 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1768 termp = find_builtin_term(term);
                      > (gdb) p term
                      > $5 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1769 if (termp->bt_string == NULL) /* did not find
                      > it */
                      > (gdb) p term
                      > $6 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1779 if (try == 0) /* try external
                      > one */
                      > (gdb) p term
                      > $7 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1780 continue;
                      > (gdb) p term
                      > $8 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                      > (gdb) p term
                      > $9 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1639 if (try == 1)
                      > (gdb) p term
                      > $10 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1675 if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                      > (gdb) p term
                      > $11 = (char_u *) 0xa0158c0 "msys"
                      > (gdb) n
                      > 1677 tp = tstrbuf;
                      > (gdb) p term
                      > $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>
                      > --------------------

                      So tgetent_error() overwrites "term". Try increasing the value for
                      TBUFSZ in vim.h. Check the documentation for tgetent() to find out what
                      the value should be. My manpage doesn't say anything...

                      --
                      hundred-and-one symptoms of being an internet addict:
                      4. Your eyeglasses have a web site burned in on them.

                      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                      \\\ download, build and distribute -- http://www.A-A-P.org ///
                      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_dev" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Dominique Pellé
                      ... 1/ OK, so the corruption happens in in tgetent_error(), most likely in line 2158 but it might be worth putting a breaking point at line term.c:2158 and
                      Message 10 of 15 , Jun 7, 2009
                      • 0 Attachment
                        Cesar Romani wrote:

                        > 1675                if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                        > (gdb) p term
                        > $11 = (char_u *) 0xa0158c0 "msys"
                        > (gdb) n
                        > 1677                    tp = tstrbuf;
                        > (gdb) p term
                        > $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>


                        1/ OK, so the corruption happens in in tgetent_error(), most likely
                        in line 2158 but it might be worth putting a breaking point at line
                        term.c:2158 and print 'term' variable before & after executing
                        line term.c:2158 to confirm that corruption happens there.

                        2151 static char_u *
                        2152 tgetent_error(tbuf, term)
                        2153 char_u *tbuf;
                        2154 char_u *term;
                        2155 {
                        2156 int i;
                        2157
                        2158 i = TGETENT(tbuf, term);
                        2159 if (i < 0 /* -1 is always an error */
                        2160 # ifdef TGETENT_ZERO_ERR
                        2161 || i == 0 /* sometimes zero is also an error */
                        2162 # endif
                        2163 )


                        2/ Most likely not enough memory is allocated for tbuf, first
                        parameter of tgetent(). Size of buffer is defined in vim.h as follows:

                        1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                        defined(__CYGWIN32__) || defined(_AIX)
                        1349 # define TBUFSZ 2048 /* buffer size for termcap entry
                        */
                        1350 #else
                        1351 # define TBUFSZ 1024 /* buffer size for termcap entry */
                        1352 #endif


                        I suspect that on your system (mingw), it's using 1024 instead
                        of 2048. If so, the attached patch might fix it. It adds
                        "defined(__MINGW32__)" (__MINGW32__ is already used
                        in several places in Vim's code):

                        1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                        defined(_AIX) \
                        1349 || defined(__CYGWIN32__) || defined(__MINGW32__)
                        1350 # define TBUFSZ 2048 /* buffer size for termcap entry
                        */
                        1351 #else
                        1352 # define TBUFSZ 1024 /* buffer size for termcap entry */
                        1353 #endif


                        2/ I also see that some implementations accept NULL as first
                        argument of tgetent() and in which case buffer is internally
                        dynamically allocated (hence more secure, but not as portable):

                        See:
                        http://www.gnu.org/software/termutils/manual/termcap-1.3/html_node/termcap_4.html

                        quote:

                        If you are using the GNU version of termcap, you can alternatively
                        ask tgetent to allocate enough space. Pass a null pointer for buffer,
                        and tgetent itself allocates the storage using malloc. There is no
                        way to get the address that was allocated, and you shouldn't try
                        to free the storage.

                        So if attached patch does not suffice, it might be worth trying to
                        replace tbuf with, i.e. try replacing lines term.c:1675:

                        if ((error_msg = tgetent_error(tbuf, term)) == NULL)

                        into...

                        if ((error_msg = tgetent_error(NULL, term)) == NULL)

                        Regards
                        -- Dominique

                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_dev" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      • Cesar Romani
                        ... Breakpoint 1, tgetent_error (tbuf=0x22f834 ¤ú , term=0xa0158c0 msys ) at term.c:2158 2158 i = TGETENT(tbuf, term); (gdb) p term $1 = (char_u
                        Message 11 of 15 , Jun 7, 2009
                        • 0 Attachment
                          Dominique Pellé wrote:
                          > Cesar Romani wrote:
                          >
                          >> 1675 if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                          >> (gdb) p term
                          >> $11 = (char_u *) 0xa0158c0 "msys"
                          >> (gdb) n
                          >> 1677 tp = tstrbuf;
                          >> (gdb) p term
                          >> $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>
                          >
                          >
                          > 1/ OK, so the corruption happens in in tgetent_error(), most likely
                          > in line 2158 but it might be worth putting a breaking point at line
                          > term.c:2158 and print 'term' variable before & after executing
                          > line term.c:2158 to confirm that corruption happens there.
                          >
                          > 2151 static char_u *
                          > 2152 tgetent_error(tbuf, term)
                          > 2153 char_u *tbuf;
                          > 2154 char_u *term;
                          > 2155 {
                          > 2156 int i;
                          > 2157
                          > 2158 i = TGETENT(tbuf, term);
                          > 2159 if (i < 0 /* -1 is always an error */
                          > 2160 # ifdef TGETENT_ZERO_ERR
                          > 2161 || i == 0 /* sometimes zero is also an error */
                          > 2162 # endif
                          > 2163 )

                          Breakpoint 1, tgetent_error (tbuf=0x22f834 "¤ú\"", term=0xa0158c0 "msys")
                          at term.c:2158
                          2158 i = TGETENT(tbuf, term);
                          (gdb) p term
                          $1 = (char_u *) 0xa0158c0 "msys"
                          (gdb) n
                          2159 if (i < 0 /* -1 is always an error */
                          (gdb) p term
                          $2 = (char_u *) 0xa0158c0 "msys"
                          (gdb) n
                          2181 return NULL;
                          (gdb) p term
                          $3 = (char_u *) 0xa0158c0 "msys"
                          (gdb) n
                          2182 }
                          (gdb) p term
                          $4 = (char_u *) 0xa0158c0 "msys"
                          (gdb) n
                          set_termname (term=0x5b455c3d <Address 0x5b455c3d out of bounds>)
                          at term.c:1677
                          1677 tp = tstrbuf;
                          (gdb) p term
                          $5 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>

                          > 2/ Most likely not enough memory is allocated for tbuf, first
                          > parameter of tgetent(). Size of buffer is defined in vim.h as follows:
                          >
                          > 1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                          > defined(__CYGWIN32__) || defined(_AIX)
                          > 1349 # define TBUFSZ 2048 /* buffer size for termcap entry
                          > */
                          > 1350 #else
                          > 1351 # define TBUFSZ 1024 /* buffer size for termcap entry */
                          > 1352 #endif
                          >
                          >
                          > I suspect that on your system (mingw), it's using 1024 instead
                          > of 2048. If so, the attached patch might fix it. It adds
                          > "defined(__MINGW32__)" (__MINGW32__ is already used
                          > in several places in Vim's code):
                          >
                          > 1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                          > defined(_AIX) \
                          > 1349 || defined(__CYGWIN32__) || defined(__MINGW32__)
                          > 1350 # define TBUFSZ 2048 /* buffer size for termcap entry
                          > */
                          > 1351 #else
                          > 1352 # define TBUFSZ 1024 /* buffer size for termcap entry */
                          > 1353 #endif

                          Your patch works only if I change __MINGW32__ by __MSYS__ or if I add
                          || defined(__MSYS__)

                          There is one problem: The backspace key doesn't delete the precedent
                          character. That was also the case on the console before applying the
                          patch.
                          On the old vim version installed on the system the backspace key works
                          fine.

                          Regards,
                          Cesar


                          --~--~---------~--~----~------------~-------~--~----~
                          You received this message from the "vim_dev" maillist.
                          For more information, visit http://www.vim.org/maillist.php
                          -~----------~----~----~----~------~----~------~--~---
                        • Dominique Pellé
                          ... Good to hear that patch works (with __MSYS__). I see that the source code of Vim never uses __MSYS__ yet. I ve never tried msys myself. Regarding the
                          Message 12 of 15 , Jun 7, 2009
                          • 0 Attachment
                            Cesar Romani wrote:
                            >
                            > Dominique Pellé wrote:
                            >
                            >> I suspect that on your system (mingw), it's using 1024 instead
                            >> of 2048. If so, the attached patch might fix it.  It adds
                            >> "defined(__MINGW32__)"  (__MINGW32__ is already used
                            >> in several places in Vim's code):
                            >>
                            >> 1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                            >> defined(_AIX) \
                            >> 1349   || defined(__CYGWIN32__) || defined(__MINGW32__)
                            >> 1350 # define TBUFSZ 2048            /* buffer size for termcap entry
                            >> */
                            >> 1351 #else
                            >> 1352 # define TBUFSZ 1024            /* buffer size for termcap entry */
                            >> 1353 #endif
                            >
                            > Your patch works only if I change __MINGW32__ by __MSYS__ or if I add
                            > || defined(__MSYS__)
                            >
                            > There is one problem: The backspace key doesn't delete the precedent
                            > character. That was also the case on the console before applying the
                            > patch.
                            > On the old vim version installed on the system the backspace key works
                            > fine.
                            >
                            > Regards,
                            > Cesar


                            Good to hear that patch works (with __MSYS__). I see that the source
                            code of Vim never uses __MSYS__ yet. I've never tried msys myself.

                            Regarding the delete key not working, can you delete with CTRL-h?
                            Did you also read ":help fixdel"? It contains useful tips when delete
                            key does not work.

                            Regards
                            -- Dominique

                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_dev" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          • Dasn
                            ... Anyway, I bet you would love the display command of gdb. e.g: (gdb) display term (gdb) n .. -- Dasn --~--~---------~--~----~------------~-------~--~----~
                            Message 13 of 15 , Jun 7, 2009
                            • 0 Attachment
                              > Breakpoint 1, set_termname (term=0xa0158c0 "msys") at term.c:1615
                              > 1615 if (term_is_builtin(term))
                              > (gdb) p term
                              > $1 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                              > (gdb) p term
                              > $2 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1639 if (try == 1)
                              > (gdb) p term
                              > $3 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1762 if (try == 2 && builtin_first && termcap_cleared)
                              > (gdb) p term
                              > $4 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1768 termp = find_builtin_term(term);
                              > (gdb) p term
                              > $5 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1769 if (termp->bt_string == NULL) /* did not find
                              > it */
                              > (gdb) p term
                              > $6 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1779 if (try == 0) /* try external
                              > one */
                              > (gdb) p term
                              > $7 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1780 continue;
                              > (gdb) p term
                              > $8 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1634 for (try = builtin_first ? 0 : 1; try < 3; ++try)
                              > (gdb) p term
                              > $9 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1639 if (try == 1)
                              > (gdb) p term
                              > $10 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1675 if ((error_msg = tgetent_error(tbuf, term)) == NULL)
                              > (gdb) p term
                              > $11 = (char_u *) 0xa0158c0 "msys"
                              > (gdb) n
                              > 1677 tp = tstrbuf;
                              > (gdb) p term
                              > $12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>

                              Anyway, I bet you would love the 'display' command of gdb. e.g:
                              (gdb) display term
                              (gdb) n
                              ..

                              --
                              Dasn


                              --~--~---------~--~----~------------~-------~--~----~
                              You received this message from the "vim_dev" maillist.
                              For more information, visit http://www.vim.org/maillist.php
                              -~----------~----~----~----~------~----~------~--~---
                            • Cesar Romani
                              ... Thanks a lot for your help. Actually when I press backspace, it behaves like the cursor left and when I press escape the characters left behind are
                              Message 14 of 15 , Jun 7, 2009
                              • 0 Attachment
                                Dominique Pellé wrote:
                                > Cesar Romani wrote:
                                >> Dominique Pellé wrote:
                                >>
                                >>> I suspect that on your system (mingw), it's using 1024 instead
                                >>> of 2048. If so, the attached patch might fix it. It adds
                                >>> "defined(__MINGW32__)" (__MINGW32__ is already used
                                >>> in several places in Vim's code):
                                >>>
                                >>> 1348 #if defined(AMIGA) || defined(__linux__) || defined(__QNX__) ||
                                >>> defined(_AIX) \
                                >>> 1349 || defined(__CYGWIN32__) || defined(__MINGW32__)
                                >>> 1350 # define TBUFSZ 2048 /* buffer size for termcap entry
                                >>> */
                                >>> 1351 #else
                                >>> 1352 # define TBUFSZ 1024 /* buffer size for termcap entry */
                                >>> 1353 #endif
                                >> Your patch works only if I change __MINGW32__ by __MSYS__ or if I add
                                >> || defined(__MSYS__)
                                >>
                                >> There is one problem: The backspace key doesn't delete the precedent
                                >> character. That was also the case on the console before applying the
                                >> patch.
                                >> On the old vim version installed on the system the backspace key works
                                >> fine.
                                >>
                                >> Regards,
                                >> Cesar
                                >
                                >
                                > Good to hear that patch works (with __MSYS__). I see that the source
                                > code of Vim never uses __MSYS__ yet. I've never tried msys myself.
                                >
                                > Regarding the delete key not working, can you delete with CTRL-h?
                                > Did you also read ":help fixdel"? It contains useful tips when delete
                                > key does not work.

                                Thanks a lot for your help.
                                Actually when I press backspace, it behaves like the cursor left and
                                when I press escape the characters left behind are deleted.
                                CTRL-h cannot delete either, neither :fixdel can fix the backspace.
                                But When I create a .vimrc file with null content in my home directory,
                                the backspace works, strange!

                                Best regards,
                                Cesar


                                --~--~---------~--~----~------------~-------~--~----~
                                You received this message from the "vim_dev" maillist.
                                For more information, visit http://www.vim.org/maillist.php
                                -~----------~----~----~----~------~----~------~--~---
                              • Matt Wozniski
                                ... That s actually the expected behavior; see :help compatible-default and :help cpo-v The upshot is that when you don t have a vimrc, vim defaults to vi
                                Message 15 of 15 , Jun 7, 2009
                                • 0 Attachment
                                  On Sun, Jun 7, 2009 at 10:07 PM, Cesar Romani wrote:
                                  >
                                  > Thanks a lot for your help.
                                  > Actually when I press backspace, it behaves like the cursor left and
                                  > when I press escape the characters left behind are deleted.
                                  > CTRL-h cannot delete either, neither :fixdel can fix the backspace.
                                  > But When I create a .vimrc file with null content in my home directory,
                                  > the backspace works, strange!

                                  That's actually the expected behavior; see :help compatible-default
                                  and :help cpo-v

                                  The upshot is that when you don't have a vimrc, vim defaults to vi
                                  compatibility, and "Backspaced characters remain visible on the screen
                                  in Insert mode," and when you do have a vimrc you no longer get the
                                  somewhat irritating vi-compatible behavior; instead "the characters
                                  are erased from the screen right away."

                                  ~Matt

                                  --~--~---------~--~----~------------~-------~--~----~
                                  You received this message from the "vim_dev" maillist.
                                  For more information, visit http://www.vim.org/maillist.php
                                  -~----------~----~----~----~------~----~------~--~---
                                Your message has been successfully submitted and would be delivered to recipients shortly.