c gdb demo

#include <stdio.h>

void test_core1() {
    int i = 0;
    scanf("%d", i);
}

void test_core2() {
    char *name = "guanxianseng";
    *name = 0;
}

int main() {
    test_core1();

    return 0;
}

1. 开启core    ulimit  -c unlimited, ulimit命令为0,表示不会生成core

编译开启调试-g, 当前目录会生成core

原文地址:https://www.cnblogs.com/luckygxf/p/12390655.html