工具链问题



  • mips工具链编译信号处理函数的时候提示找不到backtrace 和 backtrace_symbols这两个函数
    但在X86下和arm工具链下都可以编译通过,这是为什么呢
    #include <execinfo.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <signal.h>
    #include <unistd.h>
    void print_bt()
    {
    void *array[10];
    size_t size;
    char **strings;
    size_t i;

    size = backtrace (array, 10);  
    strings = backtrace_symbols (array, size); 
    printf ("*****Obtained %zd stack frames.*****\n", size);  
    
    for (i = 0; i < size; i++)  
    printf ("%s\n", strings[i]); 
    free (strings);  
    

    }
    void dump(int signo)
    {
    printf("[Program received signal SIGSEGV, Segmentation fault.id=%d]\n", signo);
    print_bt();
    exit(0);
    }
    void fun3()
    {
    print_bt();
    }

    void fun2()
    {
    fun3();
    }

    void fun1()
    {
    fun2();
    }

    int main(int argc, char *argv[])
    {
    signal(SIGSEGV, &dump);
    signal(SIGABRT, &dump);
    fun1();

    return 0;  
    

    }
    [2_1498296416434_signel.cpp](正在上传 100%) [1_1498296416433_Makefile.build](正在上传 100%) [0_1498296416432_Makefile](正在上传 100%)