hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
debug.cpp
Go to the documentation of this file.
1//
2// Created by XIaokang00010 on 2025/7/30.
3//
4
5#include <cstdint>
8#include <cstdio>
9
10#if defined (ELYSIA_RUNTIME_HPERF_ENABLE)
11#include <runtime/hperf/hperf.h>
12#endif
13
14extern "C" void runtime_debug_print(const char *message) {
15 #if defined(ELYSIA_RUNTIME_BUILD_TYPE_DEBUG)
16 printf("[Elysia/DEBUG] %s\n", message);
17 #endif
18}
19extern "C" void runtime_debug_report_current_function(const char *function_name) {
20 #if defined(ELYSIA_RUNTIME_BUILD_TYPE_DEBUG)
21 printf("[Elysia/DEBUG] Entering function %s\n", function_name);
22 #endif
23 hperf_report_func_enter(function_name);
24}
25
26extern "C" void runtime_debug_print_address(void *address) {
27 #if defined(ELYSIA_RUNTIME_BUILD_TYPE_DEBUG)
28 printf("[Elysia/DEBUG] Address: %p\n", address);
29 #endif
30}
31
32void runtime_debug_print_int(int64_t value) {
33 #if defined(ELYSIA_RUNTIME_BUILD_TYPE_DEBUG)
34 printf("[Elysia/DEBUG] Debug Integer: %lld\n", value);
35 #endif
36}
37
38void runtime_debug_print_int_1(int64_t value) {
39 printf("[Elysia/DEBUG] Debug Integer: %lld\n", value);
40}
41
42void runtime_debug_print_deci(double value) {
43 #if defined(ELYSIA_RUNTIME_BUILD_TYPE_DEBUG)
44 printf("[Elysia/DEBUG] Debug Double: %lf\n", value);
45 #endif
46}
47
48void runtime_debug_report_leave_function(const char *function_name) {
49 #if defined (ELYSIA_RUNTIME_HPERF_ENABLE)
50 hperf_report_func_leave(function_name);
51 #endif
52}
void runtime_debug_report_current_function(const char *function_name)
Definition debug.cpp:19
void runtime_debug_print_int(int64_t value)
Definition debug.cpp:32
void runtime_debug_report_leave_function(const char *function_name)
Definition debug.cpp:48
void runtime_debug_print(const char *message)
Definition debug.cpp:14
void runtime_debug_print_deci(double value)
Definition debug.cpp:42
void runtime_debug_print_address(void *address)
Definition debug.cpp:26
void runtime_debug_print_int_1(int64_t value)
Definition debug.cpp:38
void hperf_report_func_leave(const char *func_name)
Definition hperf.cpp:84
void hperf_report_func_enter(const char *func_name)
Definition hperf.cpp:73