Coredump Device

Overview

The coredump device is a pseudo-device driver with two types.A COREDUMP_TYPE_MEMCPY type exposes device tree bindings for memory address/size values to be included in any dump. And the driver exposes an API to add/remove dump memory regions at runtime. A COREDUMP_TYPE_CALLBACK device requires exactly one entry in the memory-regions array with a size of 0 and a desired size. The driver will statically allocate memory of the desired size and provide an API to register a callback function to fill that memory when a dump occurs.

Configuration Options

Related configuration options:

API Reference

group coredump_device_interface

Coredump pseudo-device driver APIs.

Typedefs

typedef void (*coredump_dump_callback_t)(uintptr_t dump_area, size_t dump_area_size)

Callback that occurs at dump time, data copied into dump_area will be included in the dump that is generated.

Param dump_area

Pointer to area to copy data into for inclusion in dump

Param dump_area_size

Size of available memory at dump_area

Functions

static inline bool coredump_device_register_memory(const struct device *dev, struct coredump_mem_region_node *region)

Register a region of memory to be stored in core dump at the time it is generated.

Parameters
  • dev – Pointer to the device structure for the driver instance.

  • region – Struct describing memory to be collected

Returns

true if registration succeeded

Returns

false if registration failed

static inline bool coredump_device_unregister_memory(const struct device *dev, struct coredump_mem_region_node *region)

Unregister a region of memory to be stored in core dump at the time it is generated.

Parameters
  • dev – Pointer to the device structure for the driver instance.

  • region – Struct describing memory to be collected

Returns

true if unregistration succeeded

Returns

false if unregistration failed

static inline bool coredump_device_register_callback(const struct device *dev, coredump_dump_callback_t callback)

Register a callback to be invoked at dump time.

Parameters
  • dev – Pointer to the device structure for the driver instance.

  • callback – Callback to be invoked at dump time

Returns

true if registration succeeded

Returns

false if registration failed

struct coredump_mem_region_node
#include <coredump.h>

Structure describing a region in memory that may be stored in core dump at the time it is generated.

Instances of this are passed to the coredump_device_register_memory() and coredump_device_unregister_memory() functions to indicate addition and removal of memory regions to be captured

Public Members

sys_snode_t node

Node of single-linked list, do not modify

uintptr_t start

Address of start of memory region

size_t size

Size of memory region