CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
blackbox.h
Go to the documentation of this file.
1#pragma once
2
38
39#include "cx/cx.h"
40#include "cx/string.h"
41
42CX_C_BEGIN
43
45#define BLACKBOX_SIZE 65535
46
48extern char dbgBlackBox[];
49
54typedef struct BlackBoxEnt {
55 uint16 prev;
56 uint16 next;
57 uint8 flags;
58 uint8 namelen;
59 uint16 vallen;
60 char name[1];
61 // char val[]; ///< Variable-length value string follows name
63
70#define bboxGetVal(ent) ((char*)ent + offsetof(BlackBoxEnt, name) + ent->namelen)
71
78#define bboxEntSize(ent) (offsetof(BlackBoxEnt, name) + ent->namelen + ent->vallen)
79
82 BBox_Private = 0x01,
83};
84
89void bboxInit();
90
102void bboxSet(_In_ strref name, _In_ strref val, uint8 flags);
103
109void bboxDelete(_In_ strref name);
110
112
113CX_C_END
void bboxInit()
char dbgBlackBox[]
Global black box buffer visible to debuggers and crash dump analyzers.
void bboxSet(strref name, strref val, uint8 flags)
BLACKBOX_FLAGS
Flags for black box entries.
Definition blackbox.h:81
void bboxDelete(strref name)
@ BBox_Private
Entry contains potentially private data; allow user opt-out in crash reports.
Definition blackbox.h:82
Copy-on-write strings with automatic memory management and rope optimization.
uint16 next
Offset to next entry (0 if last)
Definition blackbox.h:56
char name[1]
Variable-length name string (null-terminated)
Definition blackbox.h:60
uint8 flags
Flags from BLACKBOX_FLAGS enum.
Definition blackbox.h:57
uint16 vallen
Length of value including null terminator.
Definition blackbox.h:59
uint8 namelen
Length of name including null terminator.
Definition blackbox.h:58
uint16 prev
Offset to previous entry (0 if first)
Definition blackbox.h:55