Bram Moolenaar wrote:
> Liu Yubao wrote: 
>>      I found VIM(https://vim.svn.sourceforge.net/svnroot/vim/[EMAIL 
>> PROTECTED])
>> 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
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui