Chinaunix首页 | 论坛 | 博客
  • 博客访问: 40328
  • 博文数量: 32
  • 博客积分: 1326
  • 博客等级: 中尉
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-25 18:13
文章分类

全部博文(32)

文章存档

2010年(32)

我的朋友
最近访客

分类: LINUX

2010-07-03 22:54:17

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

void handler(int s)
{
    if (s == SIGBUS) printf("now got a bus error signal\n.");
    if (s == SIGSEGV) printf("now got a segmentation violation signal\n.");
    if (s == SIGILL) printf("now got an illegal instruction signal\n.");
    if (s == SIGPOLL) printf("now got a SIGPOLL signal\n.");
    exit(1);
}

int main(int argc, char** argv)
{
    int *p = NULL;
    signal(SIGBUS, handler);
    signal(SIGSEGV, handler);
    signal(SIGILL, handler);
    signal(SIGPOLL, handler);
    *p = 0;
    return 0;
}




now got a segmentation violation signal


阅读(363) | 评论(0) | 转发(0) |
0

上一篇:Windows SN

下一篇:DEBUGMSG方法

给主人留下些什么吧!~~