<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LinuxSense &#187; SIGSEGV</title>
	<atom:link href="http://www.linuxsense.org/archives/tag/sigsegv/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxsense.org</link>
	<description>分享Linux技术的点点滴滴</description>
	<lastBuildDate>Sat, 01 Aug 2009 05:23:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>关于SIGSEGV错误及处理方法（转）</title>
		<link>http://www.linuxsense.org/archives/422.html</link>
		<comments>http://www.linuxsense.org/archives/422.html#comments</comments>
		<pubDate>Wed, 21 Jan 2009 10:07:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux教程]]></category>
		<category><![CDATA[SIGSEGV]]></category>

		<guid isPermaLink="false">http://www.linuxsense.org/?p=422</guid>
		<description><![CDATA[今天编程遇到了SIGSEGV错误，比较困惑，所以找了些资料，总结一下：
（1）官方说法是：
SIGSEGV &#8212; Segment Fault. The possible cases of your encountering this error are:
1.buffer overflow &#8212; usually caused by a pointer reference out of range.
2.stack overflow &#8212; please keep in mind that the default stack size is 8192K.
3.illegal file access &#8212; file operations are forbidden on our judge system.
 
（2）SIGBUS与SIGSEGV信号的一般区别如下:
1) SIGBUS(Bus error)意味着指针所对应的地址是有效地址，但总线不能正常使用该指针。通常是未对齐的数据访问所致。
2) SIGSEGV(Segment fault)意味着指针所对应的地址是无效地址，没有物理内存对应该地址。
  
（3）Linux的mmap(2)手册页
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
使用映射可能涉及到如下信号
SIGSEGV
    试图对只读映射区域进行写操作
SIGBUS
    试图访问一块无文件内容对应的内存区域，比如超过文件尾的内存区域，或者以前有文件内容对应，现在为另一进程截断过的内存区域。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
 
弄清楚错误以后，就要查找产生错误的根源，一般我用以下两种方法：
（1）gcc -g [...]]]></description>
			<content:encoded><![CDATA[<p>今天编程遇到了SIGSEGV错误，比较困惑，所以找了些资料，总结一下：<br />
（1）官方说法是：<br />
SIGSEGV &#8212; Segment Fault. The possible cases of your encountering this error are:<br />
1.buffer overflow &#8212; usually caused by a pointer reference out of range.<br />
2.stack overflow &#8212; please keep in mind that the default stack size is 8192K.<br />
3.illegal file access &#8212; file operations are forbidden on our judge system.<br />
 <br />
（2）SIGBUS与SIGSEGV信号的一般区别如下:<br />
1) SIGBUS(Bus error)意味着指针所对应的地址是有效地址，但总线不能正常使用该指针。通常是未对齐的数据访问所致。<br />
2) SIGSEGV(Segment fault)意味着指针所对应的地址是无效地址，没有物理内存对应该地址。<br />
 <span id="more-422"></span> <br />
（3）Linux的mmap(2)手册页<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
使用映射可能涉及到如下信号<br />
SIGSEGV<br />
    试图对只读映射区域进行写操作<br />
SIGBUS<br />
    试图访问一块无文件内容对应的内存区域，比如超过文件尾的内存区域，或者以前有文件内容对应，现在为另一进程截断过的内存区域。<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 <br />
弄清楚错误以后，就要查找产生错误的根源，一般我用以下两种方法：<br />
（1）gcc -g 编译<br />
     ulimit -c 20000<br />
     之后运行程序，等core dump<br />
     最后gdb -c core &lt;exec file&gt;<br />
     来查调用栈<br />
（2）使用strace execfile，运行程序，出错时会显示那个系统调用错</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxsense.org/archives/422.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
