[kservice] Enhance support for backtrace service (#9037)

[feat] Enhance support for backtrace service

rt_backtrace_formatted_print() and rt_backtrace_to_buffer() to help
debug routines.

Also, following modification are included:
- make rt_backtrace_frame patchable with weak attr
- replace lwp backtrace with sync output

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell
2024-06-13 08:55:53 +08:00
committed by GitHub
parent 1869c543a6
commit e5b7f3fdd8
6 changed files with 174 additions and 33 deletions

View File

@@ -22,7 +22,7 @@
#include <rtdef.h>
#if defined (RT_USING_CACHE) || defined(RT_USING_SMP)
#if defined (RT_USING_CACHE) || defined(RT_USING_SMP) || defined(RT_HW_INCLUDE_CPUPORT)
#include <cpuport.h> /* include spinlock, cache ops, etc. */
#endif

View File

@@ -296,6 +296,7 @@ void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block));
* heap memory interface
*/
void rt_system_heap_init(void *begin_addr, void *end_addr);
void rt_system_heap_init_generic(void *begin_addr, void *end_addr);
void *rt_malloc(rt_size_t size);
void rt_free(void *ptr);
@@ -729,7 +730,10 @@ 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);
rt_err_t rt_backtrace_frame(rt_thread_t thread, struct rt_hw_backtrace_frame *frame);
rt_err_t rt_backtrace_formatted_print(rt_ubase_t *buffer, long buflen);
rt_err_t rt_backtrace_to_buffer(rt_thread_t thread, struct rt_hw_backtrace_frame *frame,
long skip, rt_ubase_t *buffer, long buflen);
#if defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE)
rt_device_t rt_console_set_device(const char *name);