Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Coredump APIs. More...

Data Structures

struct  coredump_cmd_copy_arg
 Coredump copy command (COREDUMP_CMD_COPY_STORED_DUMP) argument definition. More...
 

Enumerations

enum  coredump_query_id { COREDUMP_QUERY_GET_ERROR , COREDUMP_QUERY_HAS_STORED_DUMP , COREDUMP_QUERY_GET_STORED_DUMP_SIZE , COREDUMP_QUERY_MAX }
 Query ID. More...
 
enum  coredump_cmd_id {
  COREDUMP_CMD_CLEAR_ERROR , COREDUMP_CMD_VERIFY_STORED_DUMP , COREDUMP_CMD_ERASE_STORED_DUMP , COREDUMP_CMD_COPY_STORED_DUMP ,
  COREDUMP_CMD_INVALIDATE_STORED_DUMP , COREDUMP_CMD_MAX
}
 Command ID. More...
 

Functions

void coredump (unsigned int reason, const z_arch_esf_t *esf, struct k_thread *thread)
 Perform coredump.
 
void coredump_memory_dump (uintptr_t start_addr, uintptr_t end_addr)
 Dump memory region.
 
void coredump_buffer_output (uint8_t *buf, size_t buflen)
 Output the buffer via coredump.
 
int coredump_query (enum coredump_query_id query_id, void *arg)
 Perform query on coredump subsystem.
 
int coredump_cmd (enum coredump_cmd_id query_id, void *arg)
 Perform command on coredump subsystem.
 

Detailed Description

Coredump APIs.

Enumeration Type Documentation

◆ coredump_cmd_id

#include <zephyr/debug/coredump.h>

Command ID.

Enumerator
COREDUMP_CMD_CLEAR_ERROR 

Clear error code from backend.

Returns 0 if successful, failed otherwise.

COREDUMP_CMD_VERIFY_STORED_DUMP 

Verify that the stored coredump is valid.

Returns:

  • 1 if valid.
  • 0 if not valid or no stored coredump.
  • -ENOTSUP if this command is not supported.
  • Otherwise, error code from backend.
COREDUMP_CMD_ERASE_STORED_DUMP 

Erase the stored coredump.

Returns:

  • 0 if successful.
  • -ENOTSUP if this command is not supported.
  • Otherwise, error code from backend.
COREDUMP_CMD_COPY_STORED_DUMP 

Copy the raw stored coredump.

Returns:

  • copied size if successful
  • 0 if stored coredump is not found
  • -ENOTSUP if this command is not supported.
  • Otherwise, error code from backend.
COREDUMP_CMD_INVALIDATE_STORED_DUMP 

Invalidate the stored coredump.

This is faster than erasing the whole partition.

Returns:

  • 0 if successful.
  • -ENOTSUP if this command is not supported.
  • Otherwise, error code from backend.
COREDUMP_CMD_MAX 

Max value for command ID.

◆ coredump_query_id

#include <zephyr/debug/coredump.h>

Query ID.

Enumerator
COREDUMP_QUERY_GET_ERROR 

Returns error code from backend.

COREDUMP_QUERY_HAS_STORED_DUMP 

Check if there is a stored coredump from backend.

Returns:

  • 1 if there is a stored coredump, 0 if none.
  • -ENOTSUP if this query is not supported.
  • Otherwise, error code from backend.
COREDUMP_QUERY_GET_STORED_DUMP_SIZE 

Returns:

  • coredump raw size from backend, 0 if none.
  • -ENOTSUP if this query is not supported.
  • Otherwise, error code from backend.
COREDUMP_QUERY_MAX 

Max value for query ID.

Function Documentation

◆ coredump()

void coredump ( unsigned int  reason,
const z_arch_esf_t *  esf,
struct k_thread thread 
)

#include <zephyr/debug/coredump.h>

Perform coredump.

Normally, this is called inside z_fatal_error() to generate coredump when a fatal error is encountered. This can also be called on demand whenever a coredump is desired.

Parameters
reasonReason for the fatal error
esfException context
threadThread information to dump

◆ coredump_buffer_output()

int coredump_buffer_output ( uint8_t buf,
size_t  buflen 
)

#include <zephyr/debug/coredump.h>

Output the buffer via coredump.

This outputs the buffer of byte array to the coredump backend. For example, this can be called to output the coredump section containing registers, or a section for memory dump.

Parameters
bufBuffer to be send to coredump output
buflenBuffer length

◆ coredump_cmd()

int coredump_cmd ( enum coredump_cmd_id  cmd_id,
void *  arg 
)

#include <zephyr/debug/coredump.h>

Perform command on coredump subsystem.

Perform command on coredump subsystem, for example, output the stored coredump via logging.

Parameters
[in]cmd_idCommand ID
[in,out]argPointer to argument for exchanging information
Returns
Depends on the command

◆ coredump_memory_dump()

void coredump_memory_dump ( uintptr_t  start_addr,
uintptr_t  end_addr 
)

#include <zephyr/debug/coredump.h>

Dump memory region.

Parameters
start_addrStart address of memory region to be dumped
end_addrEnd address of memory region to be dumped

◆ coredump_query()

int coredump_query ( enum coredump_query_id  query_id,
void *  arg 
)

#include <zephyr/debug/coredump.h>

Perform query on coredump subsystem.

Query the coredump subsystem for information, for example, if there is an error.

Parameters
[in]query_idQuery ID
[in,out]argPointer to argument for exchanging information
Returns
Depends on the query