Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Backtrace

Capture and print a C stack backtrace. Used by the logging subsystem when CONFIG_DEBUG_WITH_BACKTRACE is enabled and called automatically on fatal errors.

Source code:

tdump()

tdump prints a formatted hexadecimal and ASCII dump of a given byte array.

void tdump(
    const char *prefix,
    const uint8_t *s,
    size_t len,
    view_fn_t view,
    int nivel
);

Parameters

KeyTypeDescription
prefixconst char *A string prefix to prepend to each line of the dump.
sconst uint8_t *Pointer to the byte array to be dumped.
lensize_tThe number of bytes to dump.
viewview_fn_tA function pointer for output formatting, typically printf.
nivelintThe verbosity level: 1 for hex only, 2 for hex and ASCII, 3 for hex, ASCII, and byte index.

Returns

This function does not return a value.

Notes

If nivel is 0, it defaults to 3. The function formats the output in a structured manner, displaying hexadecimal values alongside their ASCII representation.


tdump2json()

tdump2json converts a binary buffer into a JSON object, representing the data in a structured hexadecimal and ASCII format.

json_t *tdump2json(
    const uint8_t *s,
    size_t len
);

Parameters

KeyTypeDescription
sconst uint8_t *Pointer to the binary data buffer.
lensize_tLength of the binary data buffer.

Returns

A JSON object where each key represents an address offset and the value is a string containing the hexadecimal and ASCII representation of the corresponding data.

Notes

This function is useful for debugging and inspecting binary data in a human-readable format.