|
CX Framework
Cross-platform C utility framework
|
Data Structures | |
| struct | BlackBoxEnt |
Macros | |
| #define | BLACKBOX_SIZE 65535 |
| Size of the black box buffer in bytes (64KB) | |
| #define | bboxGetVal(ent) ((char*)ent + offsetof(BlackBoxEnt, name) + ent->namelen) |
| #define | bboxEntSize(ent) (offsetof(BlackBoxEnt, name) + ent->namelen + ent->vallen) |
Typedefs | |
| typedef struct BlackBoxEnt | BlackBoxEnt |
Enumerations | |
| enum | BLACKBOX_FLAGS { BBox_Private = 0x01 } |
| Flags for black box entries. More... | |
Functions | |
| void | bboxInit () |
| void | bboxSet (strref name, strref val, uint8 flags) |
| void | bboxDelete (strref name) |
Variables | |
| char | dbgBlackBox [] |
| Global black box buffer visible to debuggers and crash dump analyzers. | |
Fixed-size key-value data store optimized for post-mortem crash analysis.
The black box is a fixed 64KB buffer that stores debugging metadata as key-value pairs in a custom format designed to be parsed from raw memory dumps. This allows crash analyzers to extract application state even when the process is completely dead.
Design characteristics:
BLACKBOX_SIZE) with inline allocationdbgBlackBox) visible to debuggersTypical use cases:
Example:
| #define bboxEntSize | ( | ent | ) | (offsetof(BlackBoxEnt, name) + ent->namelen + ent->vallen) |
Calculate total size of a black box entry in bytes
size_t bboxEntSize(ent)
| ent | Pointer to BlackBoxEnt structure |
Definition at line 78 of file blackbox.h.
| #define bboxGetVal | ( | ent | ) | ((char*)ent + offsetof(BlackBoxEnt, name) + ent->namelen) |
Get pointer to value string within a black box entry
char* bboxGetVal(ent)
| ent | Pointer to BlackBoxEnt structure |
Definition at line 70 of file blackbox.h.
| typedef struct BlackBoxEnt BlackBoxEnt |
Black box entry structure for offline parsing
Internal structure used to parse black box contents from crash dumps. Entries are stored as a doubly-linked list with variable-length name and value.
| enum BLACKBOX_FLAGS |
Flags for black box entries.
| Enumerator | |
|---|---|
| BBox_Private | Entry contains potentially private data; allow user opt-out in crash reports. |
Definition at line 81 of file blackbox.h.
| void bboxDelete | ( | strref | name | ) |
Remove an entry from the black box
| name | Key name of entry to delete |
Frees the space used by the entry. If the entry doesn't exist, this is a no-op.
| void bboxInit | ( | ) |
Initialize the black box system
Must be called before using bboxSet or bboxDelete. Initializes internal mutex, index, and free list.
| void bboxSet | ( | strref | name, |
| strref | val, | ||
| uint8 | flags | ||
| ) |
Store or update a key-value pair in the black box
| name | Key name (stored by reference, must remain valid) |
| val | Value to store (copied into black box) |
| flags | Optional flags from BLACKBOX_FLAGS enum (0 for none) |
If an entry with the same name already exists:
Uses best-fit allocation strategy. If blackbox is full, the operation silently fails (no error or assertion).