Cthulhu  0.2.10
Cthulhu compiler collection
backtrace.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include <ctu_format_api.h>
6 
7 #include "backtrace/backtrace.h"
8 
9 #include "core/analyze.h"
10 
11 #include "format/format.h"
12 
13 #include <stdbool.h>
14 
16 
17 typedef struct arena_t arena_t;
18 typedef struct typevec_t typevec_t;
19 
24 
26 typedef struct bt_report_t bt_report_t;
27 
29 {
30 #define FMT_BT_OPTION(ID, STR, VALUE) ID = (VALUE),
31 #include "format/format.inc"
33 
35 typedef struct fmt_backtrace_t
36 {
39 
42 
45 
49  const char *project_source_path;
51 
55 CT_FORMAT_API bt_report_t *bt_report_new(IN_NOTNULL arena_t *arena);
56 
61 CT_FORMAT_API bt_report_t *bt_report_collect(IN_NOTNULL arena_t *arena);
62 
67 CT_FORMAT_API void bt_report_add(IN_NOTNULL bt_report_t *report, bt_address_t frame);
68 
73 CT_FORMAT_API void fmt_backtrace(fmt_backtrace_t fmt, IN_NOTNULL bt_report_t *report);
74 
76 
#define IN_NOTNULL
annotate a parameter as not being null
uint_least64_t bt_address_t
an address of a symbol
Definition: backtrace.h:26
#define CT_BEGIN_API
Definition: compiler.h:129
#define CT_END_API
Definition: compiler.h:130
CT_FORMAT_API bt_report_t * bt_report_collect(arena_t *arena)
collect a backtrace into a report this is equivalent to calling bt_report_new() and then bt_report_ad...
Definition: backtrace.c:504
CT_FORMAT_API bt_report_t * bt_report_new(arena_t *arena)
create a new backtrace report
Definition: backtrace.c:485
CT_FORMAT_API void bt_report_add(bt_report_t *report, bt_address_t frame)
add a frame to a backtrace report
Definition: backtrace.c:514
fmt_backtrace_options_t
Definition: backtrace.h:29
CT_FORMAT_API void fmt_backtrace(fmt_backtrace_t fmt, bt_report_t *report)
print a backtrace report
Definition: backtrace.c:426
fmt_heading_t
line heading style
Definition: format.h:18
@ eHeadingCount
Definition: format.h:22
CT_NODISCARD STA_FORMAT_STRING const char * fmt
Definition: str.h:68
an allocator object
Definition: arena.h:86
a backtrace report context
Definition: backtrace.c:29
printing options for a stacktrace
Definition: backtrace.h:36
print_options_t options
basic print options
Definition: backtrace.h:38
STA_FIELD_RANGE(0, eHeadingCount) fmt_heading_t header
the line heading style
const char * project_source_path
path to the root of the projects source directory if this is set then paths that are under this direc...
Definition: backtrace.h:49
fmt_backtrace_options_t config
configuration flags
Definition: backtrace.h:44
generic print options
Definition: format.h:35
A vector with a fixed type size.
Definition: vector.h:24