Core Dump
何谓 core?
在使用半导体作为内存的材料前,人类是利用线圈当作内存的材料(发明 者为王安),线圈就叫作 core ,用线圈做的内存就叫作 core memory。如今 ,半导体工业澎勃发展,已经没有人用 core memory 了,不过,在许多情况下, 人们还是把记忆体叫作core 。 何谓 core dump? 我们在开发(或使用)一个程序时,最怕的就是程序莫明其妙地当掉。虽然系 统没事,但我们下次仍可能遇到相同的问题。于是这时操作系统就会把程序当掉 时的内存内容dump 出来(现在通常是写在一个叫 core 的 file 里面),让 我们或是 debugger 做为参考。这个动作就叫作 core dump。 执行路由核心复制 core dump包含一份当前系统内存中信息的精确拷贝。捕捉包含在内存中信息的方法有:
1) 配置路由器在崩溃时执行Core Dump,存储到TFTP、FTP、RCP服务器:
对TFTP协议,只需指定TFTP服务器IP,不需要任何附加的配置:
Router(config)#exception dump 192.168.1.1 ;TFTP服务器的IP地址
对FTP协议的配置:
对RCP协议的配置:
2) 在系统没有崩溃的情况下,执行Core Dump命令。
Router#write core
Core Dump仅在Cisco工程师测试和解决路由器问题时有用。 Table Of ContentsCreating Core Dumps
When a router crashes, it is sometimes useful to obtain a full copy of the memory image (called a core dump)
to identify the cause of the crash. Core dumps are generally very
useful to your technical support representative. Not all crash types
will produce a core dump. The different crash types are discussed in
more details in Appendix B, "Memory Maps."
![]()
Caution
Basic Setup
Four basic ways exist for setting up the router to generate a core dump:
•
•
•
•
Using TFTPIf TFTP is used to dump
the core file to the TFTP server, the router will dump only the first
16 MB of the core file. This is a limitation of most TFTP applications.
Therefore, if your router's main memory is more than 16 MB, do not use
TFTP.
The following is the router configuration needed for getting a core dump using TFTP:
exception dump a.b.c.d
Here, a.b.c.d is the IP address of the TFTP server.
The core dump is written to a file named hostname-core on the TFTP server, where hostname is the name of the router. You can change the name of the core file by adding the exception core-file filename configuration command.
Depending on the TFTP
server application used, it may be necessary to create on the TFTP
server the empty target file to which the router can write the core.
Also make sure that you have enough memory on your TFTP server to hold
the complete core dump.
Using FTP
To configure the router for core dump using FTP, use the following configuration commands:
ip ftp usename username
ip ftp password password
exception protocol ftp
exception dump a.b.c.d
Here, a.b.c.d is the IP address of the FTP server. If the username and password are not configured, the router will attempt anonymous FTP.
Using rcpRemote copy protocol (rcp)
can also be used to capture a core dump. Enabling rcp on a router will
not be covered in this appendix. Refer to the Cisco IOS Software
Configuration document for configuring rcp.
After rcp is enabled on the router, the following commands must be added to capture the core dump using rcp:
exception protocol rcp
exception dump a.b.c.d
Here, a.b.c.d is the IP address of the host enabled for rcp.
Using a Flash DiskSome router platforms
support the Flash disk as an alternative to the linear Flash memory or
PCMCIA Flash card. The large storage capacity of these Flash disks
makes them good candidates for another means of capturing core dump.
For information on the router platforms and IOS versions that support
the Flash disk, refer to the Cisco IOS Release Notes.
The following is the router configuration command needed to set up a core dump using a Flash disk:
exception flash <procmem|iomem|all> <device_name[:partition_number]> <erase | no_erase>
The show flash all command will give you a list of devices that you can use for the exception flash command.
Advanced Setup
The configuration commands in this section may be used in addition to those described in the "Basic Setup" section.
Exception MemoryDuring the debugging
process, you can cause the router to create a core dump and reboot when
certain memory size parameters are violated. The following exception memory commands are used to trigger a core dump:
exception memory minimum size
The previous code is used to define the minimum free memory pool size.
exception memory fragment size
The previous code is used to define the minimum size of contiguous block of memory in the free pool.
The value of size is in bytes and is checked every 60 seconds. If you enter a size that is greater than the free memory, and if the exception dump command has been configured, a core dump and router reload is generated after 60 seconds. If the exception dump command is not configured, the router reloads without generating a core dump.
Debug Sanity
In some cases, the technical support representative will request that debug sanity
be enabled when setting up the core dump. This is a hidden command in
most IOS releases, but it sometimes is necessary to debug memory
corruption. With debug sanity, every buffer that is used in the system is sanity-checked when it is allocated and when it is freed.
The debug sanity
command must be issued in privileged exec mode (enable mode) and
involves some CPU utilization. However, it will not significantly
affect the router's functionality.
Not all types of crash require debug sanity to be enabled. Use this command only when your technical support representative requires it.
To disable debug sanity, use the privileged exec command undebug sanity.
Testing the Core Dump Setup
When the router is configured for core dump, it may be useful to test whether the setup works.
The IOS provides a special command to test or trigger a core dump:
write core
Use this command in
privileged exec mode (enable mode). This command will cause a crash,
and the content of the memory will be dumped accordingly. If it no core
dump is generated, the whole setup and config must be reviewed.
![]()
Caution 本文出自 51CTO.COM技术博客 |



天使之城
博客统计信息
热门文章
最新评论
友情链接