1 #ifndef __LUNAIX_TRACE_H
2 #define __LUNAIX_TRACE_H
4 #include <lunaix/boot_generic.h>
5 #include <lunaix/hart_state.h>
7 #include <sys-generic/trace_arch.h>
24 unsigned long ksym_count;
25 struct ksym_entry syms[0];
30 struct ksyms* ksym_table;
34 * @brief Init the trace service using loaded modksyms module
39 trace_modksyms_init(struct boot_handoff* bhctx);
42 * @brief Locate the symbol which is the closest to given pc.
45 * @return struct ksym_entry*
48 trace_sym_lookup(ptr_t pc);
51 * @brief Walk the stack backwards to generate stack trace
60 trace_walkback(struct trace_record* tb_buffer,
66 * @brief Print the stack trace starting from the given frame pointer
71 trace_printstack_of(ptr_t fp);
74 * @brief Print the stack trace given the current interrupt context. In addition
75 * to the stacktrace, this will also print all context switches happened
76 * beforehand, and all stack trace in each context. Recommended for verbose
82 trace_printstack_isr(const struct hart_state* hstate);
85 * @brief Print the stack trace starting from caller's frame pointer.
92 trace_log(const char* fmt, ...);
94 #endif /* __LUNAIX_TRACE_H */