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

Re: [BUG] VIM exits when do profiling

Expand Messages
  • Liu Yubao
    ... I test the program below on Debian Etch, Debian Lenny, Ubuntu Gusty, Fedora Core and FreeBSD, strangely it doesn t trigger func_deadly() only on FreeBSD.
    Message 1 of 5 , Mar 5, 2008
    • 0 Attachment
      Bram Moolenaar wrote:
      > Liu Yubao wrote:
      >> I found VIM(https://vim.svn.sourceforge.net/svnroot/vim/vim7@929)
      >> exits when I enable profiling flags in src/Makefile:
      >
      >> I compile and test the code on Debian Etch.
      >
      > I'm running on FreeBSD, it works just fine without disabling that
      > SIGPROF line. Is there something about Debian that works differently
      > with signals?
      >

      I test the program below on Debian Etch, Debian Lenny, Ubuntu Gusty,
      Fedora Core and FreeBSD, strangely it doesn't trigger func_deadly()
      only on FreeBSD. I'm not sure whether it's a bug or a feature in Linux
      kernel.

      Here are some version information:
      Debian Etch: linux kernel 2.6.18-4-686, gcc 4.1.2, libc 2.3.6
      Debian Lenny: linux kernel 2.6.22-3-686, gcc 4.2.3, libc 2.7
      Ubuntu Gusty: linux kernel 2.6.22-14-generic(x86_64), gcc 4.1.3, libc 2.6.1
      Fedora Core 6: linux kernel 2.6.20(x86_64), gcc 4.1.2, libc 2.5
      Fedora Core 7: linux kernel 2.6.23.8-34(x86_64), gcc 4.1.2
      FreeBSD 6.2: gcc 3.4.6
      FreeBSD 7.0: gcc 4.2.1

      And the source code:

      /*
      * $ gcc -g -pg -o sigprof sigprof.c
      * $ ./sigprof
      */
      #include <stdio.h>
      #include <unistd.h>
      #include <signal.h>

      void func_deadly(int signo)
      {
      fprintf(stderr, "dead: signo=%d, SIGPROF=%d\n", signo, SIGPROF);
      _exit(1);
      }


      int main(void)
      {
      int n = 0;
      int a = 1, b = 2;
      struct sigaction sa;

      sa.sa_handler = func_deadly;
      sa.sa_flags = SA_ONSTACK;
      sigemptyset(&sa.sa_mask);
      sigaction(SIGPROF, &sa, NULL);

      #if 1
      /* can receive SIGPROF */
      while (++n < 10000000)
      a = a * b * b * a * b * b / 3;
      #else
      /* can't receive SIGPROF */
      while (++n < 4)
      sleep(2);
      #endif

      return 0;
      }


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... I tried disabling SIGPROF on FreeBSD, doesn t seem to make a difference. Did you try that -D in the Makefile, as I suggested? -- ... /// Bram Moolenaar --
      Message 2 of 5 , Mar 5, 2008
      • 0 Attachment
        Liu Yubao wrote:

        > >> I found VIM(https://vim.svn.sourceforge.net/svnroot/vim/vim7@929)
        > >> exits when I enable profiling flags in src/Makefile:
        > >
        > >> I compile and test the code on Debian Etch.
        > >
        > > I'm running on FreeBSD, it works just fine without disabling that
        > > SIGPROF line. Is there something about Debian that works differently
        > > with signals?
        > >
        >
        > I test the program below on Debian Etch, Debian Lenny, Ubuntu Gusty,
        > Fedora Core and FreeBSD, strangely it doesn't trigger func_deadly()
        > only on FreeBSD. I'm not sure whether it's a bug or a feature in Linux
        > kernel.
        >
        > Here are some version information:
        > Debian Etch: linux kernel 2.6.18-4-686, gcc 4.1.2, libc 2.3.6
        > Debian Lenny: linux kernel 2.6.22-3-686, gcc 4.2.3, libc 2.7
        > Ubuntu Gusty: linux kernel 2.6.22-14-generic(x86_64), gcc 4.1.3, libc 2.6.1
        > Fedora Core 6: linux kernel 2.6.20(x86_64), gcc 4.1.2, libc 2.5
        > Fedora Core 7: linux kernel 2.6.23.8-34(x86_64), gcc 4.1.2
        > FreeBSD 6.2: gcc 3.4.6
        > FreeBSD 7.0: gcc 4.2.1

        I tried disabling SIGPROF on FreeBSD, doesn't seem to make a difference.
        Did you try that -D in the Makefile, as I suggested?

        --
        From "know your smileys":
        :'-D Laughing so much that they're crying

        /// 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
        -~----------~----~----~----~------~----~------~--~---
      • Liu Yubao
        ... Yes, I tried, it works on Linux. It seems it s a problem specific to Linux. Best regards, Liu Yubao --~--~---------~--~----~------------~-------~--~----~
        Message 3 of 5 , Mar 5, 2008
        • 0 Attachment
          Bram Moolenaar wrote:
          > Liu Yubao wrote:
          >
          >> I test the program below on Debian Etch, Debian Lenny, Ubuntu Gusty,
          >> Fedora Core and FreeBSD, strangely it doesn't trigger func_deadly()
          >> only on FreeBSD. I'm not sure whether it's a bug or a feature in Linux
          >> kernel.
          >>
          >> Here are some version information:
          >> Debian Etch: linux kernel 2.6.18-4-686, gcc 4.1.2, libc 2.3.6
          >> Debian Lenny: linux kernel 2.6.22-3-686, gcc 4.2.3, libc 2.7
          >> Ubuntu Gusty: linux kernel 2.6.22-14-generic(x86_64), gcc 4.1.3, libc 2.6.1
          >> Fedora Core 6: linux kernel 2.6.20(x86_64), gcc 4.1.2, libc 2.5
          >> Fedora Core 7: linux kernel 2.6.23.8-34(x86_64), gcc 4.1.2
          >> FreeBSD 6.2: gcc 3.4.6
          >> FreeBSD 7.0: gcc 4.2.1
          >
          > I tried disabling SIGPROF on FreeBSD, doesn't seem to make a difference.
          > Did you try that -D in the Makefile, as I suggested?
          >

          Yes, I tried, it works on Linux. It seems it's a problem specific to Linux.


          Best regards,

          Liu Yubao

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