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

39151Re: VIM crashes in one extreme situation

Expand Messages
  • Bram Moolenaar
    Mar 1, 2005
      Alejandro Lopez Valencia wrote:

      > Bram Moolenaar wrote:
      > > Mathias Michaelis wrote:
      > >>If I do a :version I get among other things
      > >>
      > >>compiled: gcc -O3 -fomit ...
      > >>linked: gcc -s -o gvim.exe ...
      > >
      > >
      > > That explains why __try isn't used. From os_win32.h:
      > >
      > > #if defined(_MSC_VER) || defined(__BORLANDC__)
      > > /* Support for __try / __except. All versions of MSVC and Borland C are
      > > * expected to have this. Any other compilers that support it? */
      > > # define HAVE_TRY_EXCEPT 1
      > >
      > > Assuming that gcc doesn't support __try, we can maybe use longjmp()?
      > > The code currently is in os_unix.c, it could be moved to a common file.
      > > Someone who wants to try this? First check if the setjmp.h include file
      > > exists.
      > Yes. Mingw supports longjmp(), at least the runtime version I have
      > available (the latest, btw). I can't commit to move the longjmp code to
      > a different file soon, but I'll try (if anyone beats me to it, please do
      > and receive my eternal gratitude :-).

      I just tried using longjmp() yesterday. That works, but the problem is
      that we need to get a signal for the out-of-stack situation, so that we
      can jump somewhere. But we don't seem to have a chance to catch the
      signal. At least, I could not see it happen.

      I looked around for another solution and found some code to simulate
      __try with MingW. It is using assembly code... There is also __try1
      and __except1 in the MingW header files, but they do not do everything
      we need.

      I included it in the latest snapshot, but it's disabled. It worked
      sometimes, but at least not when the optimizer was enabled. The code is
      in src/regexp.c. Define MINGW_TRY to try out the code.

      The examples I found with this mechanism are around very simple code.
      We do recursive function calls. That might be the reason it doesn't
      work for Vim.

      If someone has good ideas how to make this work reliably, let's hear it!
      Otherwise the only solution is to compile with MSVC.

      hundred-and-one symptoms of being an internet addict:
      264. You turn to the teletext page "surfing report" and are surprised that it
      is about sizes of waves and a weather forecast for seaside resorts.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
    • Show all 19 messages in this topic