本文介绍了SIGSEGV的信号处理程序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我目前的项目中,我使用信号进行错误处理。由于我

无法显示完整的代码,我刚刚展示了一段重要的代码,其中

是相关的。


void sigsegenv( )

{

printf(" \ n\\\
********** FDS讯息**********) * \ n\\\
");

printf(&\\; \ n \ n ********** SEGMENTATIONFAULT
$ F $ b FDS内* ********** \ n \ n");

退出(-1);

}

int main(void)

{

............

........ ...

信号(SIGSEGV,sigsegenv);

...........

..... ......

}


我想这可能会让我们知道发生了什么。

我的信号处理程序总是没有抓住SIGSEGV。有一段时间它有时候没有捕捉到b $ b。请让我知道我做错了什么

Hi all,
In my current project I am using signals for error handling. Since I
cannot show full code, I have just shown important piece of code which
is relevant.

void sigsegenv()
{
printf("\n\n ********** F D S Message ***********\n\n");
printf("\n\n ********** S E G M E N T A T I O N F A U L T
inside F D S ***********\n\n");
exit(-1);
}
int main(void)
{
............
...........
signal ( SIGSEGV ,sigsegenv);
...........
...........
}

I think this might give some idea about what is happening.
My signal handler is not catching SIGSEGV always. Some time it is
catching sometimes not. Please let me know what am I doing wrong

推荐答案




你有什么证据表明处理程序没有捕获SIGSEGV?

如果它只是printf()没有出现,那么你可能会遇到限制你在处理程序中可以做什么。


-

一切都是虚荣。 - 传道书



What evidence have you found that the handler is not catching SIGSEGV ?
If it is just that the printf() are not occuring, then you might
be encountering the restrictions on what you can do in a handler.

--
All is vanity. -- Ecclesiastes




您能否告诉我有关信号处理程序的限制或

我可以找到有关信号处理程序限制的更多信息?


谢谢,

Madhav。


Could you please tell me about restrictions on signal handlers or where
I can find more info about restrictions on signal handlers?

Thanks,
Madhav.





他刚刚做了。

或者我可以在哪里找到有关信号处理程序限制的更多信息?



He just did.
or where I can find more info about restrictions on signal handlers?




这就是整件事。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999


电子邮件:rjh在上面的域名(但显然放弃了www)



That''s the whole thing.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


这篇关于SIGSEGV的信号处理程序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 23:34
查看更多