CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
__debug.h
1#pragma once
3#include <stddef.h>
4#include <stdint.h>
5
6/**
7 * The kind of value, for values that have special-cased handling.
8 */
9enum DebugFormatArgumentKind : ptraddr_t
10{
11 /// Boolean, printed as "true" or "false".
12 DebugFormatArgumentBool,
13 /// Single character.
14 DebugFormatArgumentCharacter,
15 /// Signed 32-bit integer, printed as decimal.
16 DebugFormatArgumentSignedNumber32,
17 /// Unsigned 32-bit integer, printed as hexadecimal
18 DebugFormatArgumentUnsignedNumber32,
19 /// Signed 64-bit integer, printed as decimal.
20 DebugFormatArgumentSignedNumber64,
21 /// Unsigned 64-bit integer, printed as hexadecimal.
22 DebugFormatArgumentUnsignedNumber64,
23 /// 32-bit floating-point value, printed as decimal.
24 DebugFormatArgumentFloat,
25 /// 64-bit floating-point value, printed as decimal.
26 DebugFormatArgumentDouble,
27 /// Pointer, printed as a full capability.
28 DebugFormatArgumentPointer,
29 /// Special case for permission sets, printed as in the capability
30 /// format.
31 DebugFormatArgumentPermissionSet,
32 /// C string, printed as-is.
33 DebugFormatArgumentCString,
34 /// String view, printed as-is.
35 DebugFormatArgumentStringView,
36};
37
39{
40 /**
41 * The value that is being written.
42 */
43 uintptr_t value;
44 /**
45 * The kind of value that is being written. This is either a pointer
46 * to a `DebugCallback` or one of the `Kind` enumeration, depending on
47 * whether the tag is set or not.
48 */
49 uintptr_t kind;
50};
51
52/**
53 * Library function that writes a debug message. This runs with interrupts
54 * disabled (to avoid interleaving) and prints an array of debug messages. This
55 * is intended to allow a single call to print multiple format strings without
56 * requiring the format strings to be copied, so that the debugging APIs can
57 * wrap a user-provided format string.
58 */
59__cheri_libcall void
60debug_log_message_write(const char *context,
61 const char *format,
62 struct DebugFormatArgument *messages,
63 size_t messageCount);
64
65/**
66 * Helper to write a debug message reporting an assertion or invariant failure.
67 * This should be used only with the helper macros / templates in `debug.h[h]`.
68 * This takes the kind of failure (for example, assert or invariant), the file,
69 * function, and line number where the failure occurred, a format string, and
70 * an array of arguments to the format string.
71 */
72__cheri_libcall void debug_report_failure(const char *kind,
73 const char *file,
74 const char *function,
75 int line,
76 const char *fmt,
77 struct DebugFormatArgument *arguments,
78 size_t argumentCount);
Macros for interacting with the compartmentalisation model in CHERIoT.
uintptr_t value
The value that is being written.
Definition __debug.h:43
uintptr_t kind
The kind of value that is being written.
Definition __debug.h:49