mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 09:02:20 +08:00
[kservice] improve backtrace service in kernel (#8144)
Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
@@ -421,6 +421,7 @@ typedef int (*init_fn_t)(void);
|
||||
#define RT_ENOENT ENOENT /**< No entry */
|
||||
#define RT_ENOSPC ENOSPC /**< No space left */
|
||||
#define RT_EPERM EPERM /**< Operation not permitted */
|
||||
#define RT_EFAULT EFAULT /**< Bad address */
|
||||
#define RT_ETRAP 254 /**< Trap event */
|
||||
#else
|
||||
#define RT_EOK 0 /**< There is no error */
|
||||
@@ -438,6 +439,7 @@ typedef int (*init_fn_t)(void);
|
||||
#define RT_ENOSPC 12 /**< No space left */
|
||||
#define RT_EPERM 13 /**< Operation not permitted */
|
||||
#define RT_ETRAP 14 /**< Trap event */
|
||||
#define RT_EFAULT 15 /**< Bad address */
|
||||
#endif /* defined(RT_USING_LIBC) && !RT_USING_LIBC_ISO_ONLY */
|
||||
|
||||
/**@}*/
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* 2018-11-17 Jesven add rt_hw_spinlock_t
|
||||
* add smp support
|
||||
* 2019-05-18 Bernard add empty definition for not enable cache case
|
||||
* 2023-10-16 Shell Support a new backtrace framework
|
||||
*/
|
||||
|
||||
#ifndef __RT_HW_H__
|
||||
@@ -20,6 +21,10 @@
|
||||
|
||||
#include <rtdef.h>
|
||||
|
||||
#if defined (RT_USING_CACHE) || defined(RT_USING_SMP)
|
||||
#include <cpuport.h> /* include spinlock, cache ops, etc. */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -145,9 +150,20 @@ void rt_hw_context_switch_to(rt_ubase_t to);
|
||||
void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to, rt_thread_t from_thread, rt_thread_t to_thread);
|
||||
#endif /*RT_USING_SMP*/
|
||||
|
||||
/**
|
||||
* Hardware Layer Backtrace Service
|
||||
*/
|
||||
struct rt_hw_backtrace_frame {
|
||||
rt_base_t fp;
|
||||
rt_base_t pc;
|
||||
};
|
||||
|
||||
rt_err_t rt_hw_backtrace_frame_get(rt_thread_t thread, struct rt_hw_backtrace_frame *frame);
|
||||
|
||||
rt_err_t rt_hw_backtrace_frame_unwind(rt_thread_t thread, struct rt_hw_backtrace_frame *frame);
|
||||
|
||||
void rt_hw_console_output(const char *str);
|
||||
|
||||
void rt_hw_backtrace(rt_uint32_t *fp, rt_ubase_t thread_entry);
|
||||
void rt_hw_show_memory(rt_uint32_t addr, rt_size_t size);
|
||||
|
||||
/*
|
||||
@@ -170,7 +186,6 @@ void rt_hw_ipi_send(int ipi_vector, unsigned int cpu_mask);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
#include <cpuport.h> /* for spinlock from arch */
|
||||
|
||||
struct rt_spinlock
|
||||
{
|
||||
@@ -216,9 +231,7 @@ struct rt_spinlock
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_CACHE
|
||||
#include <cpuport.h>
|
||||
#else
|
||||
#ifndef RT_USING_CACHE
|
||||
#define rt_hw_isb()
|
||||
#define rt_hw_dmb()
|
||||
#define rt_hw_dsb()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* 2022-06-04 Meco Man remove strnlen
|
||||
* 2023-05-20 Bernard add rtatomic.h header file to included files.
|
||||
* 2023-06-30 ChuShicheng move debug check from the rtdebug.h
|
||||
* 2023-10-16 Shell Support a new backtrace framework
|
||||
*/
|
||||
|
||||
#ifndef __RT_THREAD_H__
|
||||
@@ -658,6 +659,11 @@ void rt_components_board_init(void);
|
||||
#else
|
||||
int rt_kprintf(const char *fmt, ...);
|
||||
void rt_kputs(const char *str);
|
||||
|
||||
rt_err_t rt_backtrace(void);
|
||||
rt_err_t rt_backtrace_thread(rt_thread_t thread);
|
||||
rt_err_t rt_backtrace_frame(struct rt_hw_backtrace_frame *frame);
|
||||
|
||||
#endif /* RT_USING_CONSOLE */
|
||||
|
||||
int rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
|
||||
|
||||
Reference in New Issue
Block a user