ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
instrument_cov.c File Reference

SanitizerCoverage runtime hooks for code coverage tracking. More...

Go to the source code of this file.

Functions

void __sanitizer_cov_trace_pc_guard (uint32_t *guard)
 
void __sanitizer_cov_trace_pc_guard_init (uint32_t *start, uint32_t *stop)
 

Detailed Description

SanitizerCoverage runtime hooks for code coverage tracking.

Implements the runtime interface for Clang's SanitizerCoverage instrumentation. Provides two hooks that are automatically called by the compiler:

Coverage data is logged via the instrumentation logging system for analysis in post-processing and coverage report generation.

See also
include/ascii-chat/tooling/panic/instrument_log.h

Definition in file instrument_cov.c.

Function Documentation

◆ __sanitizer_cov_trace_pc_guard()

void __sanitizer_cov_trace_pc_guard ( uint32_t *  guard)

Definition at line 25 of file instrument_cov.c.

25 {
26 if (guard == NULL || *guard == 0U) {
27 return;
28 }
29
30 asciichat_instr_log_pc((uintptr_t)__builtin_return_address(0));
31}
void asciichat_instr_log_pc(uintptr_t program_counter)
Log a program counter for coverage analysis.

References asciichat_instr_log_pc().

◆ __sanitizer_cov_trace_pc_guard_init()

void __sanitizer_cov_trace_pc_guard_init ( uint32_t *  start,
uint32_t *  stop 
)

Definition at line 33 of file instrument_cov.c.

33 {
34 if (start == NULL || stop == NULL || start == stop) {
35 return;
36 }
37
38 if (*start != 0U) {
39 return;
40 }
41
42 uint32_t counter = 1U;
43 for (uint32_t *it = start; it < stop; ++it) {
44 if (*it == 0U) {
45 *it = counter++;
46 }
47 }
48}
unsigned int uint32_t
Definition common.h:58