ΪÁË¿ìËÙ¶¨Î»ºÍ½â¾öÕâЩÎÊÌ⣬LinuxϵͳÌṩÁËÒ»ÖÖÇ¿´óµÄ»úÖÆ¡ª¡ªÉú³ÉcoreÎļþ£¨Ò²³ÆΪºËÐÄת´¢Îļþ£¬coredump£©
±¾ÎĽ«Ïêϸ½éÉÜÈçºÎÔÚLinuxϵͳÖÐÊÕ¼¯ºÍ·ÖÎöcoreÎļþ£¬°ïÖú¶ÁÕßÕÆÎÕÕâÒ»ÖØÒªµÄ¹ÊÕÏÅŲ鼼ÄÜ
Ò»¡¢CoreÎļþµÄÖØÒªÐÔ CoreÎļþÊDzÙ×÷ϵͳÔÚ½ø³ÌÔËÐÐÒì³£ÖÕÖ¹»ò±ÀÀ£Ê±£¬½«³ÌÐòµ±Ê±µÄÄÚ´æ״̬¼Ç¼ÏÂÀ´£¬±£´æÔÚÒ»¸öÎļþÖеĻúÖÆ
Õâ¸öÎļþ°üº¬Á˳ÌÐò±ÀÀ£Ê±µÄÄÚ´æÐÅÏ¢¡¢¼Ä´æÆ÷״̬¡¢ÄÚ´æ¹ÜÀíÐÅÏ¢ÒÔ¼°ÆäËû´¦ÀíÆ÷ºÍ²Ù×÷ϵͳ״̬ÐÅÏ¢
¿ÉÒÔ½«ÆäÊÓΪ¡°ÄÚ´æ¿ìÕÕ¡±£¬¶ÔÓÚ±à³ÌÈËÔ±Õï¶ÏºÍµ÷ÊÔ³ÌÐò·Ç³£ÓаïÖú
ÀýÈ磬µ±³ÌÐò·¢ÉúSegmentation fault£¨¶Î´íÎó£©Ê±£¬Í¨³£ÊÇÓÉÓÚÄÚ´æ²»µ±²Ù×÷Ôì³ÉµÄ£¬Èç¿ÕÖ¸Õë¡¢Ò°Ö¸ÕëµÄ¶Áд²Ù×÷£¬Êý×éÔ½½ç·ÃÎʵÈ
ÕâЩ´íÎóºÜÄÑÖØÏÖ£¬µ«coreÎļþ¿ÉÒÔÔÙÏÖ³ÌÐò³ö´íʱµÄÇé¾°£¬´Ó¶ø°ïÖú¿ª·¢ÈËԱѸËÙÕÒµ½ÎÊÌâ¸ùÔ´
¶þ¡¢ÉèÖÃÓëÉú³ÉCoreÎļþ ÔÚLinuxϵͳÖУ¬Éú³ÉcoreÎļþÐèÒª½øÐÐһЩÉèÖÃ
ÒÔÏÂÊǾßÌå²½Ö裺 1.¼ì²éulimitÉèÖà ʹÓÃ`ulimit`ÃüÁî¿ÉÒԲ鿴ºÍÐÞ¸ÄÓû§¼¶±ðµÄ×ÊÔ´ÏÞÖÆ
È·±£core file×ÊÔ´ÏÞÖƲ»Îª0£¬ÕâÑù²ÅÄÜÉú³ÉcoreÎļþ
¿ÉÒÔͨ¹ýÒÔÏÂÃüÁî²é¿´µ±Ç°coreÎļþ´óСÏÞÖÆ£º bash ulimit -c Èç¹ûÊä³öΪ0£¬±íʾ½ûÓÃÁËcoreÎļþÉú³É
¿ÉÒÔͨ¹ýÒÔÏÂÃüÁîÀ´ÐÞ¸ÄÏÞÖÆ£º bash ulimit -c unlimited Õ⽫ÉèÖÃcoreÎļþ´óСÏÞÖÆΪÎÞÏÞÖÆ
2.È·¶¨coreÎļþµÄÉú³ÉĿ¼ ĬÈÏÇé¿öÏ£¬coreÎļþ½«Éú³ÉÔÚµ±Ç°¹¤×÷Ŀ¼
µ«¿ÉÒÔͨ¹ý²é¿´ºÍÐÞ¸Ä`/proc/sys/kernel/core_pattern`ÎļþÀ´Ö¸¶¨Éú³ÉĿ¼
ʹÓÃÒÔÏÂÃüÁî²é¿´µ±Ç°coreÎļþ´æ´¢Ä¿Â¼£º bash cat /proc/sys/kernel/core_pattern Èç¹ûÐèÒª¸ü¸ÄÉú³ÉĿ¼£¬¿ÉÒÔ±à¼`/etc/sysctl.conf`Îļþ£¬Ìí¼Ó»òÐÞ¸ÄÒÔϲÎÊý£º bash kernel.core_pattern = /path/to/corefile/core-%e-%p ÆäÖУ¬`%e`±íʾÃüÁîÃû£¬`%p`±íʾ½ø³ÌID
±£´æÎļþºó£¬Ö´ÐÐ`sysctl -p`ʹÉèÖü´Ê±ÉúЧ
3.´¥·¢coreÎļþÉú³É ÏÖÔÚ£¬¿ÉÒÔͨ¹ý¹ÊÒâÈóÌÐò³ö´í¡¢·¢ËÍÐźţ¨ÈçSIGSEGV£©»òÖ´ÐÐÆäËûµ¼Ö³ÌÐòÒì³£Í˳öµÄ²Ù×÷À´´¥·¢coreÎļþÉú³É
ÀýÈ磬±àдһ¸ö¹ÊÒâµ¼Ö¶δíÎóµÄC³ÌÐò£º
c
include
Èý¡¢²éÕÒÓë¹ÜÀíCoreÎļþ
ÔÚLinuxϵͳÖУ¬²éÕÒcoreÎļþµÄλÖÃÐèҪһЩÃüÁîºÍ¼¼ÇÉ ÒÔÏÂÊǾßÌå·½·¨£º
1.ʹÓÃfindÃüÁî²éÕÒ
¿ÉÒÔʹÓÃ`find`ÃüÁîÀ´²éÕÒϵͳÖÐËùÓеÄcoreÎļþ ÀýÈ磬ÔÚÕû¸öÎļþϵͳÖÐËÑË÷ÒÔ¡°core¡±¿ªÍ·µÄÎļþ£º
bash
find / -name core -print
Õ⽫ÁгöËùÓÐÕÒµ½µÄcoreÎļþ·¾¶
2.²é¿´ÏµÍ³Ä¬ÈϵÄcoreÎļþ´æ´¢Ä¿Â¼
ͨ¹ý`cat /proc/sys/kernel/core_pattern`ÃüÁî¿ÉÒԲ鿴ϵͳµ±Ç°µÄcoreÎļþ´æ´¢Ä¿Â¼ ÕâÓÐÖúÓÚ¿ìËÙ¶¨Î»coreÎļþµÄλÖÃ
3.ʹÓÃgcoreÃüÁîÉú³ÉcoreÎļþ
Èç¹û³ÌÐòÔÚÔËÐйý³ÌÖÐûÓÐÉú³ÉcoreÎļþ£¬¿ÉÒÔʹÓÃ`gcore`ÃüÁîÖ÷¶¯Éú³ÉÒ»¸öcoreÎļþ ÀýÈ磺
bash
Linuxϵͳ¿ìËÙÇå¿Õ·ÓÉÖ¸ÄÏ
LinuxϵͳץȡCoreÎļþʵս¼¼ÇÉ
Öйú¿Æ´óLinux£ºÌ½Ë÷¸ßУ¿Æ¼¼Ç°ÑصĿªÔ´Ö®ÂÃ
HyperÐéÄ⻯¼¯Èº£º´òÔì¸ßЧÔƼÆËã»ùʯ
Xshell²Ù×÷Ö¸ÄÏ£º¿ìËÙ½øÈëÏîÄ¿½Ì³Ì
LinuxϵͳÏÂFlex 6°æ±¾°²×°Ö¸ÄÏ£ºÇáËÉÉÏÊֽ̳Ì
Hyperƽ̨´òÔì¸ßЧÈí·ÓÉÖ¸ÄÏ
Linuxϵͳ¿ìËÙÇå¿Õ·ÓÉÖ¸ÄÏ
Öйú¿Æ´óLinux£ºÌ½Ë÷¸ßУ¿Æ¼¼Ç°ÑصĿªÔ´Ö®ÂÃ
LinuxϵͳÏÂFlex 6°æ±¾°²×°Ö¸ÄÏ£ºÇáËÉÉÏÊֽ̳Ì
Linux TopÃüÁî½ÒÃØ£ºÐÔÄÜÇ°10´ó½ÒÃØ
Linux·ÖÇøÓëÎļþϵͳÉî¶È½âÎö
Linuxϵͳϲ鿴Ïß³Ì״̬¼¼ÇÉ
Linux»·¾³Ï¿ª·¢Ó¦Ó㺴ÓÁ㿪ʼдAppÈ«¹¥ÂÔ
LinuxÏÂIBus PinyinÊäÈ뷨ȫ¹¥ÂÔ
Linux1108£º½âËø¸ßЧÔËάм¼ÇÉ
LinuxϵͳÇáËÉÉèÖþ²Ì¬IP½Ì³Ì
ÕÆÎÕ¼¼ÇÉ£ºÈçºÎÔÚLinux»·¾³Ï½øÐÐmake build¹¹½¨
Linux»·¾³ÏÂFortran±àÒëÖ¸ÄÏ