gdb调试代码栈

 

 https://www.cnblogs.com/zhurizhe/p/3412369.html

 

 gdb -p 20480 --batch -ex 'set pagination off' -ex 'thread apply all bt’

 

#include <fstream>
bool isFileExists_ifstream(const char * name) {
    std::ifstream f(name);
    return f.good();
}

void hello3()
{
    if (isFileExists_ifstream("/tmp/1.txt"))
    {
        printf("File is existed\n");
        sleep(1000);
    }
    else
    {
        printf("hello\n");
    }
}

 

posted @ 2021-09-16 23:31  renhl  阅读(42)  评论(0编辑  收藏  举报