core_dump_internals.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Anatomy of Core Dump Image
  2. --------------------------
  3. :link_to_translation:`zh_CN:[中文]`
  4. A core dump file's format can be configured to use the ELF format, or a legacy binary format. The ELF format is recommended for all new designs as it provides more information regarding the software's state at the moment the crash occurs, e.g., CPU registers and memory contents.
  5. The memory state embeds a snapshot of all tasks mapped in the memory space of the program. The CPU state contains register values when the core dump has been generated. The core dump file uses a subset of the ELF structures to register this information.
  6. Loadable ELF segments are used to store the process' memory state, while ELF notes (``ELF.PT_NOTE``) are used to store the process' metadata (e.g., PID, registers, signal etc). In particular, the CPU's status is stored in a note with a special name and type (``CORE``, ``NT_PRSTATUS type``).
  7. Here is an overview of the core dump layout:
  8. .. figure:: ../../_static/core_dump_format_elf.png
  9. :align: center
  10. :alt: Core Dump ELF Image Format
  11. :figclass: align-center
  12. Core Dump ELF Image Format
  13. .. figure:: ../../_static/core_dump_format_bin.png
  14. :align: center
  15. :alt: Core Dump Binary Image Format
  16. :figclass: align-center
  17. Core Dump Binary Image Format
  18. .. note::
  19. The format of the image file shown in the above pictures represents the current version of the image and can be changed in future releases.
  20. Overview of Implementation
  21. --------------------------
  22. The figure below describes some basic aspects related to the implementation of the core dump:
  23. .. figure:: ../../_static/core_dump_impl.png
  24. :align: center
  25. :alt: Core Dump Implementation Overview
  26. :figclass: align-center
  27. Core Dump Implementation Overview
  28. .. note::
  29. The diagram above hides some details and represents the current implementation of the core dump which can be changed later.